[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拷貝到啟動(dòng)項(xiàng)
[root@lnmp ~]# /etc/init.d/mysqld start #啟動(dòng)MYSQL數(shù)據(jù)庫(kù)
Starting MySQL.... SUCCESS!
[root@lnmp ~]# netstat -tunlp|grep 3306 #查看是否開啟了mysql數(shù)據(jù)庫(kù)端口3306
tcp 0 0 :::3306 :::* LISTEN 1773/mysqld
[root@lnmp ~]# /etc/init.d/mysqld stop #停止mysql數(shù)據(jù)庫(kù)
Shutting down MySQL.. SUCCESS!
[root@lnmp ~]# netstat -tunlp|grep 3306 #查看是否關(guān)閉了mysql的默認(rèn)端口3306
[root@lnmp ~]#
備注:你可以將/usr/local/mysql/bin加入PATH中。這樣可以直接輸入mysql或者mysqladmin,不用輸入全路徑。