- 连接数据库
shell> mysql -h host -u user -p
Enter password: ********
当登录的 mysql 是本机 mysql 时,可以忽略 host,仅仅使用以下代码即可
shell> mysql -u user -p
- 退出数据库
mysql> QUIT
Bye
On Unix, you can also disconnect by pressing Control+D.
mysql> SELECT VERSION(), CURRENT_DATE;
+-----------+--------------+
| VERSION() | CURRENT_DATE |
+-----------+--------------+
| 5.7.19 | 2018-07-22 |
+-----------+--------------+
1 row in set (0.00 sec)