1. 进入mysql
mysql -r -p
2. 展示所有数据库
show databases;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| istester |
| mysql |
| performance_schema |
| sys |
+--------------------+
3. 进入某个库
mysql> use istester; 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
4.查看当前所在数据库
mysql> select database(); +------------+ | database() | +------------+ | istester | +------------+ 1 row in set (0.00 sec)
5. 查看当前库下有哪些表
mysql> show tables; +--------------------+ | Tables_in_istester | +--------------------+ | idoxu | | istester | | istester2 | +--------------------+ 3 rows in set (0.03 sec)