MariaDB
MariaDB基础应用
1、创建testdb数据库,并设置为默认库
MariaDB [(none)]> CREATE DATABASE testdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> use testdb
Database changed
MariaDB [testdb]>
2、创建学生表
2.1 创建学生表;
id字段为int整型,不使用符号,不能为空,设为主键;
name字段为可变长字段(20字符),不能为空;
age字段为最小整型(0-255),不使用符号;
MariaDB [testdb]> CREATE TABLE students (id int UNSIGNED NOT NULL PRIMARY KEY,name VARCHAR(20) NOT NULL,age tinyint UNSIGNED);
2.2 查看学生表结构
MariaDB [testdb]> DESC students;
+-------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+-------+
| id | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
+-------+---------------------+------+-----+---------+-------+
3 rows in set (0.01 sec)
MariaDB [testdb]>
2.3 创建tbl2表,定义两个主键方法
MariaDB [testdb]> CREATE TABLE tbl2 (id int UNSIGNED NOT NULL,name VARCHAR(20) NOT NULL,age tinyint UNSIGNED, PRIMARY KEY(id,name));
Query OK, 0 rows affected (0.02 sec)
MariaDB [testdb]> DESC tbl2;
+-------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+-------+
| id | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | PRI | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
+-------+---------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
MariaDB [testdb]>
3、查看student表时由哪些命令创建的
MariaDB [testdb]> SHOW CREATE TABLE students;
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| students | CREATE TABLE `students` (
`id` int(10) unsigned NOT NULL,
`name` varchar(20) NOT NULL,
`age` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
查看表状态
MariaDB [testdb]> SHOW TABLE STATUS LIKE 'students'\G
*************************** 1. row ***************************
Name: students
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 10485760
Auto_increment: NULL
Create_time: 2016-08-30 15:41:41
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
获取修改表的帮助
MariaDB [testdb]> HELP ALTER TABLE;
修改表
1、在students表里添加gender字段,并放在最后面
MariaDB [testdb]> ALTER TABLE students ADD gender ENUM('m','f');
Query OK, 0 rows affected (0.09 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> DESC students;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| id | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
| gender | enum('m','f') | YES | | NULL | |
+--------+---------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
MariaDB [testdb]>
2、更改id字段名为sdid,需要把字段类型加上去,类型修饰符必须紧跟在类型后面;主键默认永久存在不需要再定义
MariaDB [testdb]> ALTER TABLE students CHANGE id sid int UNSIGNED NOT NULL;
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> DESC students;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| sid | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
| gender | enum('m','f') | YES | | NULL | |
+--------+---------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
5、删除字段
MariaDB [testdb]> DESC stutdents
-> ;
ERROR 1146 (42S02): Table 'testdb.stutdents' doesn't exist
MariaDB [testdb]> DESC students;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| sid | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
| gender | enum('m','f') | YES | | NULL | |
| qq | int(11) | YES | | NULL | |
+--------+---------------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
MariaDB [testdb]> ALTER TABLE students DROP qq;
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> DESC students;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| sid | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
| gender | enum('m','f') | YES | | NULL | |
+--------+---------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
MariaDB [testdb]>
6、在name字段添加唯一键约束
MariaDB [testdb]> ALTER TABLE students ADD UNIQUE KEY(name);
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> DESC students;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| sid | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | UNI | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
| gender | enum('m','f') | YES | | NULL | |
+--------+---------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
MariaDB [testdb]>
7、年龄字段添加索引
MariaDB [testdb]> ALTER TABLE students ADD INDEX(age);
Query OK, 0 rows affected (0.09 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> DESC students
-> ;
+--------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| sid | int(10) unsigned | NO | PRI | NULL | |
| name | varchar(20) | NO | UNI | NULL | |
| age | tinyint(3) unsigned | YES | MUL | NULL | |
| gender | enum('m','f') | YES | | NULL | |
+--------+---------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
查看一个表的索引:
MariaDB [testdb]> SHOW INDEXES FROM students;
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| students | 0 | PRIMARY | 1 | sid | A | 0 | NULL | NULL | | BTREE | | |
| students | 0 | name | 1 | name | A | 0 | NULL | NULL | | BTREE | | |
| students | 1 | age | 1 | age | A | 0 | NULL | NULL | YES | BTREE | | |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)
8、删除索引
MariaDB [testdb]> ALTER TABLE students DROP age;
Query OK, 0 rows affected (0.10 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> SHOW INDEXES FROM students;
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| students | 0 | PRIMARY | 1 | sid | A | 0 | NULL | NULL | | BTREE | | |
| students | 0 | name | 1 | name | A | 0 | NULL | NULL | | BTREE | | |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set (0.00 sec)
9、删除索引
MariaDB [testdb]> DROP INDEX name ON students;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [testdb]> SHOW INDEX FROM students;
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| students | 0 | PRIMARY | 1 | sid | A | 0 | NULL | NULL | | BTREE | | |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
1 row in set (0.00 sec)
MariaDB [testdb]>
DML:INSET,DELETE,SELECT,UPDATE
INSERT
插入两行数据
MariaDB [testdb]> INSERT INTO students VALUES (1,'Yang Guo','m'),(2,'Guo Xiang','f');
Query OK, 2 rows affected (0.07 sec)
Records: 2 Duplicates: 0 Warnings: 0
MariaDB [testdb]> SELECT * FROM students;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
+-----+-----------+--------+
2 rows in set (0.00 sec)
MariaDB [testdb]>
gender项可以为空,再插入二行数据
MariaDB [testdb]> INSERT INTO students (sid,name) VALUES (3,'Zhang Wuji'),(4,'Zhao Min');
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
MariaDB [testdb]> SELECT * FROM students;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
4 rows in set (0.00 sec)
MariaDB [testdb]>
SELECT
查询整张表的内容
MariaDB [testdb]> SELECT * FROM students;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
4 rows in set (0.00 sec)
查询所有sid小于3的行
MariaDB [testdb]> SELECT * FROM students WHERE sid<3;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
+-----+-----------+--------+
2 rows in set (0.06 sec)
MariaDB [testdb]>
查看gender=m的行
MariaDB [testdb]> SELECT * FROM students WHERE gender='m';
+-----+----------+--------+
| sid | name | gender |
+-----+----------+--------+
| 1 | Yang Guo | m |
+-----+----------+--------+
1 row in set (0.05 sec)
MariaDB [testdb]>
显示gender值为空的行
MariaDB [testdb]> SELECT * FROM students WHERE gender IS NULL;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
2 rows in set (0.03 sec)
MariaDB [testdb]>
显示gender值不为空的行
MariaDB [testdb]> SELECT * FROM students WHERE gender IS NOT NULL;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
+-----+-----------+--------+
2 rows in set (0.00 sec)
MariaDB [testdb]>
查找表的所有内容,并根据名字排序
MariaDB [testdb]> SELECT * FROM students ORDER BY name;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 2 | Guo Xiang | f |
| 1 | Yang Guo | m |
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
4 rows in set (0.04 sec)
MariaDB [testdb]>
降序排序
MariaDB [testdb]> SELECT * FROM students ORDER BY name DESC;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 4 | Zhao Min | NULL |
| 3 | Zhang Wuji | NULL |
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
+-----+------------+--------+
4 rows in set (0.00 sec)
MariaDB [testdb]>
名字降序排序,并只显示前两个
MariaDB [testdb]> SELECT * FROM students ORDER BY name DESC LIMIT 2;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 4 | Zhao Min | NULL |
| 3 | Zhang Wuji | NULL |
+-----+------------+--------+
2 rows in set (0.00 sec)
跳过第一个,显示前两个
MariaDB [testdb]> SELECT * FROM students ORDER BY name DESC LIMIT 1,2;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 3 | Zhang Wuji | NULL |
| 1 | Yang Guo | m |
+-----+------------+--------+
2 rows in set (0.00 sec)
显示SID大于等于2小于等于4的行
MariaDB [testdb]> SELECT * FROM students WHERE sid>=2 and sid <=4;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 2 | Guo Xiang | f |
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
3 rows in set (0.00 sec)
第二种写法,BETWEEN 2个值之间:
MariaDB [testdb]> SELECT * FROM students WHERE sid BETWEEN 2 AND 4;
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 2 | Guo Xiang | f |
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
3 rows in set (0.01 sec)
MariaDB [testdb]>
显示name字段Z开头的行
MariaDB [testdb]> SELECT * FROM students WHERE name LIKE 'Z%';
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 3 | Zhang Wuji | NULL |
| 4 | Zhao Min | NULL |
+-----+------------+--------+
2 rows in set (0.00 sec)
MariaDB [testdb]>
使用正则表达式查询行中带u的行;
MariaDB [testdb]> SELECT * FROM students WHERE name RLIKE '.*u.*';
+-----+------------+--------+
| sid | name | gender |
+-----+------------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
| 3 | Zhang Wuji | NULL |
+-----+------------+--------+
3 rows in set (0.04 sec)
MariaDB [testdb]>
用正则表达式查找前面一个大写字母(A-G)后面带u的行
MariaDB [testdb]> SELECT * FROM students WHERE name RLIKE '.*[A-G]u.*';+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
+-----+-----------+--------+
2 rows in set (0.01 sec)
MariaDB [testdb]>
查询整张表的内容,并将sid字段别名为stuid,将name字段别名为 stuname,
MariaDB [testdb]> SELECT sid as stuid,name as stuname FROM students;
+-------+------------+
| stuid | stuname |
+-------+------------+
| 1 | Yang Guo |
| 2 | Guo Xiang |
| 3 | Zhang Wuji |
| 4 | Zhao Min |
+-------+------------+
4 rows in set (0.03 sec)
DELTE
删除sid=3的行
MariaDB [testdb]> DELETE FROM students WEHRE sid=3;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WEHRE sid=3' at line 1
MariaDB [testdb]> DELETE FROM students WHERE sid=3;
Query OK, 1 row affected (0.07 sec)
MariaDB [testdb]>
MariaDB [testdb]> SELECT * FROM students;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
| 4 | Zhao Min | NULL |
+-----+-----------+--------+
3 rows in set (0.00 sec)
UPDATE
修改sid为4的gender值为f
MariaDB [testdb]> UPDATE students SET gender='f' WHERE sid=4;
Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [testdb]> SELECT * FROM students;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
| 4 | Zhao Min | f |
+-----+-----------+--------+
3 rows in set (0.00 sec)
MariaDB [testdb]>
创建用户账号
1、创建用户
MariaDB [(none)]> CREATE USER 'wpuser'@'%' IDENTIFIED BY 'wpp@ss';
Query OK, 0 rows affected (0.01 sec)
MariaDB [mysql]> SELECT User,Host,Password FROM user;
+--------+-----------+-------------------------------------------+
| User | Host | Password |
+--------+-----------+-------------------------------------------+
| root | localhost | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | qq | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | 127.0.0.1 | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| root | ::1 | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| | localhost | |
| | qq | |
| wpuser | 127.0.0.1 | *E4C14E76CFB222E64362BA03BC3F5A0206E7F0E8 |
| wpuser | % | *D763A435C015D6AA05A435779E5D9CB9B6266278 |
+--------+-----------+-------------------------------------------+
8 rows in set (0.00 sec)
登陆测试
[root@qq ~]# mysql -u wpuser -h 10.201.106.130 -p
Enter password:
mysql> SHOW DATABASES
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)
用户权限
查看用户权限
MariaDB [(none)]> SHOW GRANTS FOR 'wpuser'@'%';
+-------------------------------------------------------------------------------------------------------+
| Grants for wpuser@% |
+-------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wpuser'@'%' IDENTIFIED BY PASSWORD '*D763A435C015D6AA05A435779E5D9CB9B6266278' |
+-------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MariaDB [(none)]>
查看root管理员权限
显示当前用户权限
MariaDB [(none)]> SHOW GRANTS FOR CURRENT_USER;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*E74858DB86EBA20BC33D0AECAE8A8108C56B17FA' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]>
MariaDB [(none)]> SHOW GRANTS FOR CURRENT_USER();
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*E74858DB86EBA20BC33D0AECAE8A8108C56B17FA' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]>
用户授权
创建用户并授权,然后远程登录测试
1、创建用户并授权
MariaDB [(none)]> GRANT SELECT,DELETE ON testdb.*TO 'testuser'@'%' IDENTIFIED BY 'testpass';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
2、登录测试
mysql>
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| testdb |
+--------------------+
3 rows in set (0.01 sec)
mysql> use testdb
Database changed
mysql>
mysql> SHOW GRANTS FOR CURRENT_USER;
+---------------------------------------------------------------------------------------------------------+
| Grants for testuser@% |
+---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'testuser'@'%' IDENTIFIED BY PASSWORD '*00E247AC5F9AF26AE0194B41E1E769DEE1429A29' |
| GRANT SELECT, DELETE ON `testdb`.* TO 'testuser'@'%' |
+---------------------------------------------------------------------------------------------------------+
2 rows in set (0.01 sec)
mysql>
3、权限测试
mysql> CREATE TABLE tbl2 (id int);
ERROR 1142 (42000): CREATE command denied to user 'testuser'@'10.201.106.129' for table 'tbl2'
mysql>
mysql> SELECT * FROM students;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
| 4 | Zhao Min | f |
+-----+-----------+--------+
3 rows in set (0.01 sec)
mysql>
mysql> DELETE FROM students where sid=4;
Query OK, 1 row affected (0.05 sec)
mysql> SELECT * FROM students;
+-----+-----------+--------+
| sid | name | gender |
+-----+-----------+--------+
| 1 | Yang Guo | m |
| 2 | Guo Xiang | f |
+-----+-----------+--------+
2 rows in set (0.00 sec)
mysql>
权限回收
MariaDB [(none)]> REVOKE DELETE ON testdb.* FROM 'testuser'@'%';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
MariaDB [(none)]> SHOW GRANTS FOR 'testuser'@'%';
+---------------------------------------------------------------------------------------------------------+
| Grants for testuser@% |
+---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'testuser'@'%' IDENTIFIED BY PASSWORD '*00E247AC5F9AF26AE0194B41E1E769DEE1429A29' |
| GRANT SELECT ON `testdb`.* TO 'testuser'@'%' |
+---------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)