启动和停止MYSQL8

1.启动MYSQL服务器
使用服务
    service mysql start
使用init.d
    /etc/init.d/mysql start
如果没有找到启动脚本,则可以从解压的位置进行复制
    cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
如果安装包含systemd支持
    systemctl start mysqld
如果不支持systemd,可以使用mysqld_safe启动mysql
    mysqld_safe —user mysql &
2.停止mysql服务器
使用service
    service mysql stop
使用init.d
    /etc/init.d/mysql stop
包含systemd支持
    systemctl stop mydqld
使用mysqladmin
    mysqladmin -u root -p shutdown
3.检查mysql服务器状态
使用service
    service mysql status
使用init.d
    /etc/init.d/mysql status
如果安装包含systemd支持
    systemctl status mysqld
root@ebs-26932:~# service mysql status
● mysql.service – MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-05-26 13:58:24 UTC; 6min ago
     Docs: man:mysqld(8)
  Process: 18280 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 18328 (mysqld)
   Status: “SERVER_OPERATING”
    Tasks: 38 (limit: 1113)
   CGroup: /system.slice/mysql.service
           └─18328 /usr/sbin/mysqld
May 26 13:58:20 ebs-26932 systemd[1]: Starting MySQL Community Server…
May 26 13:58:24 ebs-26932 systemd[1]: Started MySQL Community Server.