命令行下查看用户、数据库:
0 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
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 this 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 | …………………………………省略部分内容……………………………… | 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; #查看用户、主机 +------+-----------+ | 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'; #删除用户名为空,主机名为localhost mysql> drop user ''@'lamp'; #删除主机名为lamp,用户名为空 Query OK, 0 rows affected (0.09 sec) mysql> select user,host from mysql.user; #查看是否删除成功 +------+-----------+ | user | host | +------+-----------+ | root | 127.0.0.1 | | root | ::1 | | | lamp | | root | lamp | | root | localhost | +------+-----------+ 5 rows in set (0.00 sec) mysql> delete from mysql.user where user='' and host='lamp'; #如果无法删除的可以采用类似此种的方法进行删除 mysql> flush privileges; |
申明:本文由BYRD原创(基于Mysql5.6.16),未经许可禁止转载! SourceByrd's Weblog-https://note.t4x.org/database/show-database-tables/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!