1: 显示数据库
SHOW DATABASES,
2:当前选择的数据库,
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| test |
+------------+
3:当前数据库包含的表信息:
mysql> SHOW TABLES;
+---------------------+
| Tables in test |
+---------------------+
| mytable1 |
| mytable2 |
+---------------------+
4:获取表结构
mysql> desc mytable1;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| s1 | varchar(20) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
5:执行外部的sql脚本
shell> mysql < input.sql
在当前数据库上执行input.sql
或
shell> mysql test < input.sql
在test数据库上执行input.sql
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】