~# systemctl status mysql //查看MySQL运行状态 ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2020-12-08 12:56:12 UTC; 3s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 2673 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 2709 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 4915) Memory: 378.4M CGroup: /system.slice/mysql.service └─2709 /usr/sbin/mysqld
Dec 08 12:56:12 tecmint systemd[1]: Starting MySQL Community Server... Dec 08 12:56:12 tecmint systemd[1]: Started MySQL Community Server.
常用systemctl命令
1 2 3 4
~# systemctl start mysql //启动 ~# systemctl restart mysql //重启 ~# systemctl stop mysql //停止 ~# systemctl reload mysql //重载
测试访问mysql shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
~# mysql -uroot -p //root访问mysql shell Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5268 Server version: 8.0.22 MySQL Community Server - GPL
Copyright (c) 2000, 2020, 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.