1. 程式人生 > >mysql 第一次啟動及常用命令

mysql 第一次啟動及常用命令



啟動

mysql -u root -p

進入後

# 顯示有幾個資料庫
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

# 切換資料庫
mysql> use mysql
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> select * from user;