linux下Mysql的启动关闭的命令
下面我来为各位介绍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,不用输入全路径。