forked from PylypPrylyp/HW_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash2_check.sh
More file actions
32 lines (30 loc) · 1.28 KB
/
bash2_check.sh
File metadata and controls
32 lines (30 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
#
echo "*****************************************************************************"
mysql --version
echo "*****************************************************************************"
sleep 6
# mysql -u root -e "show databases;"
mysql -u root <<EOT
Create user test1221@localhost identified by 'pass';
Grant all privileges on *.* to test1221@localhost identified by 'pass' with grant option;
#Grant all privileges on *.* to test1212@'%' identified by 'pass' with grant option;
#Create user 'test12'@'localhost' identified by 'pass';
#Grant Select on *.* to test12@localhost identified by 'pass';
#Grant Select on *.* to test12@'%' identified by 'pass';
Flush PRIVILEGES;
EOT
#mysql -u test12 -ppass -e "show databases;"
mysql -u test1221 -ppass -e "show grants for test1221@localhost;"
sleep 5
#mysql -u test1212 -ppass -e "show grants for test12@localhost;"
#sleep 3
mysql -u test1221 -ppass -e "use test; create table t1 ( column1 varchar(20), column2 varchar(20) );"
mysql -u test1221 -ppass -e "use test; insert into t1 (column1, column2) values ('data1', 'data2');"
mysql -u test1221 -ppass -e "use test; select * from t1;"
sleep 5
mysql -u test1221 -ppass -e "use test; drop table t1;"
mysql -u test1221 -ppass -e "show tables from test;"
#
#
echo "<< Mariadb is installed, and works. >>"