mysql> show grants for \'testuser\'@\'localhost\';
+----------------------------------------------------------------------------------------------------+
| Grants for testuser@localhost |
+----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO \'testuser\'@\'localhost\' IDENTIFIED BY PASSWORD \'*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9\' |
| GRANT CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `test_gbk`.* TO \'testuser\'@\'localhost\' |
+------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
注:原来不知道all权限到底是哪些权限,采用这种方法之后,应该就清楚了
SELECT,INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER
5、创建、删除表
mysql> create table test(id int(4)not null,name char(20)not null);
#建表,并且建立两个字段
Query OK, 0 rows affected (0.06 sec)
mysql> show tables;#查看表
+--------------------+
| Tables_in_test_gbk |
+--------------------+
| test |
+--------------------+
1 row in set (0.00 sec)
mysql> desc test; #查看表结构
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id | int(4) | NO | | NULL | |
| name | char(20) | NO | | NULL | |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> create table test1(id int(4)not null,name char(20)not null);
Query OK, 0 rows affected (0.01 sec)
mysql> show tables;
+------------------------+
| Tables_in_test_gbk |
+------------------------+
| test |
| test1 |
+--------------------+
2 rows in set (0.00 sec)
删除表
mysql> drop tables test;
Query OK, 0 rows affected (0.00 sec)
mysql> show tables;
+--------------------+
| Tables_in_test_gbk |
+--------------------+
| test1 |
+--------------------+
1 row in set (0.00 sec)
查看建表
mysql> show create table test1\G
*************************** 1. row ***************************
Table: test1
Create Table: CREATE TABLE `test1` (
`id` int(4) NOT NULL,
`name` char(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=gbk
1 row in set (0.00 sec)