下面我來為各位介紹linux下Mysql的啟動關閉的命令,有需要了解的朋友不防進入看看吧.
linux下Mysql的啟動關閉(本文基於centos6.4、mysql5.7.3),mysql安裝在/usr/local/mysql目錄下:
[root@lnmp ~]# /usr/local/mysql/bin/mysql --version
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.7.3-m13, for Linux (x86_64) using EditLine wrapper
[root@lnmp ~]# /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld #將mysql.server拷貝到啟動項
[root@lnmp ~]# /etc/init.d/mysqld start #啟動MYSQL數據庫
Starting MySQL.... SUCCESS!
[root@lnmp ~]# netstat -tunlp|grep 3306 #查看是否開啟了mysql數據庫端口3306
tcp 0 0 :::3306 :::* LISTEN 1773/mysqld
[root@lnmp ~]# /etc/init.d/mysqld stop #停止mysql數據庫
Shutting down MySQL.. SUCCESS!
[root@lnmp ~]# netstat -tunlp|grep 3306 #查看是否關閉了mysql的默認端口3306
[root@lnmp ~]#
備注:你可以將/usr/local/mysql/bin加入PATH中。這樣可以直接輸入mysql或者mysqladmin,不用輸入全路徑。