mysql中显示当前使用的数据库名称
By admin
- One minute read - 57 wordsmysql> select database();
+------------+
| database() |
+------------+
| csdn |
+------------+
1 row in set (0.00 sec)
mysql> SELECT * FROM information_schema.SCHEMATA where schema_name='csdn';
+--------------+-------------+----------------------------+------------------------+----------+
| CATALOG_NAME | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |
+--------------+-------------+----------------------------+------------------------+----------+
| NULL | csdn | latin1 | latin1_swedish_ci | NULL |
+--------------+-------------+----------------------------+------------------------+----------+
1 row in set (0.00 sec)
mysql>