$ sudo service mysql status ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since 日 2017-06-11 17:05:11 CST; 14min ago Main PID: 11970 (mysqld) CGroup: /system.slice/mysql.service └─11970 /usr/sbin/mysqld
6月 11 17:05:09 frin systemd[1]: Starting MySQL Community Server... 6月 11 17:05:11 frin systemd[1]: Started MySQL Community Server.
使用下面的命令停止MySQL:
1
sudo service mysql stop
使用下面的命令启动MySQL:
1
sudo service mysql start
连接/断开MySQL服务器:
使用root用户连接MySQL服务器:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ mysql -h 127.0.0.1 -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.18-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.