MySQL 服務常用操作命令
阿新 • • 發佈:2018-06-14
KS man moni resp The code 用戶名 TE password
1、MySQL 服務設置
在使用
mysql.server
命令之前需要將路徑/usr/local/mysql/support-files
添加到系統環境變量中。export PATH=$PATH:/usr/local/mysql/support-files
在使用
mysql
命令之前需要將路徑/usr/local/mysql/bin
添加到系統環境變量中。export PATH=$PATH:/usr/local/mysql/bin
具體設置請參照《添加系統環境變量》章節。
2、MySQL 服務常用操作
2.1 MySQL 服務控制命令
MySQL 服務控制命令
# 啟動 MySQL 服務 $ sudo mysql.server start Starting MySQL .. SUCCESS!
# 停止 MySQL 服務 $ sudo mysql.server stop Shutting down MySQL .. SUCCESS!
# 重啟 MySQL 服務 $ sudo mysql.server restart Shutting down MySQL .. SUCCESS! Starting MySQL .. SUCCESS!
# 重新加載 $ sudo mysql.server reload SUCCESS! Reloading service MySQL
# 強制重新加載 $ sudo mysql.server force-reload SUCCESS! Reloading service MySQL
# 查看 MySQL 服務狀態 $ mysql.server status ERROR! Multiple MySQL running but PID file could not be found (61998 62083 )
2.2 MySQL 服務連接命令
MySQL 服務連接命令
# 登錄 MySQL 服務 # mysql -u 用戶名 -p 密碼 $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 930 Server version: 8.0.11 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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' for help. Type '\c' to clear the current input statement. mysql>
# 登出 MySQL 服務 > exit Bye
MySQL 服務常用操作命令