MySQL查看当前使用的数据库
介绍三种方法:---建议使用第一种,简单明了!!!
select database();
show tables;
status;
第一种方法:
mysql> select database();
+------------+
| database() |
+------------+
| test |
+------------+
1 row in set (0.01 sec)
第二种方法:
mysql> show tables;
+----------------------+
| Tables_in_test |
+----------------------+
| test_t_charge_record |
+----------------------+
1 row in set (0.01 sec)
第三种方法:
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.6.37, for Linux (x86_64) using EditLine wrapper
Connection id: 71
Current database: test
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.37 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 1 hour 13 min 43 sec
Threads: 9 Questions: 491 Slow queries: 0 Opens: 97 Flush tables: 1 Open tables: 83 Queries per second avg: 0.111
--------------