View users, databases at the command line:
mysql> Use GBK #进入gbk数据库
Database changed
Mysql> Show tables; #查看gbk数据库的所有表
Empty Set (0.00 sec)
mysql> use Ultrax;
Reading table information for completion of table and column names
You can turn off the feature to get a quicker startup with-a
Database changed
mysql> show tables,
mysql> show tables from ultrax; #查看ultrax数据库的数据表 [mysql> show tables in Ultrax;]
+-----------------------------------+
| tables_in_ultrax |
+-----------------------------------+
| pre_common_admincp_cmenu |
| pre_common_admincp_group |
... ... ....... ....... ....... ....... ..... ... Omit part of the content ....... ....... ...... ...... .....
| pre_ucenter_tags |
| pre_ucenter_vars |
+-----------------------------------+
293 rows in Set (0.01 sec)
Mysql> Use GBK
Database changed
Mysql> Select Database ();
+------------+
| Database () |
+------------+
| GBK |
+------------+
1 row in Set (0.00 sec)
Mysql> select User,host from Mysql.user; #查看用户, Host
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| Root | :: 1 |
| | Lamp |
| Root | Lamp |
| | localhost |
| Root | localhost |
+------+-----------+
6 rows in Set (0.06 sec)
mysql> drop user ' @ ' localhost '; #删除用户名为空, host name is localhost
mysql> drop user ' @ ' lamp '; #删除主机名为lamp, the user name is empty
Query OK, 0 rows affected (0.09 sec)
Mysql> select User,host from mysql.us er; #查看是否删除成功
+------+-----------+
| user | host |
+------ +-----------+
| root | 127.0.0.1 |
| root |::1 |
| | lamp |
| root | lamp |
| root | localhost |
+------+-----------+
5 rows in Set (0.00 sec)
Mysql> deletes from Mysql.user where user= ' and host= ' lamp '; #如果无法删除的可以采用类似此种的方法进行删除
mysql> flush privileges;