MySQL8.0启动和关闭流程
生活随笔
收集整理的這篇文章主要介紹了
MySQL8.0启动和关闭流程
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
啟動方式
1、 mysqld_safe &(推薦):這個腳本會監(jiān)控mysqld的狀態(tài),日志會記錄到文件里
2、 mysqld & 日志打印到屏幕上
3、 mysql.server
調(diào)用的執(zhí)行過程:systemd ------>/etc/init.d/mysqld-------->mysql.server------>mysqld_safe &----->mysqld &
關(guān)閉方式
mysql> shutdown;
systemctl stop mysqld
service mysqld stop
mysqladmin -uroot -p123456 shutdown
忘記管理員密碼
1、關(guān)閉數(shù)據(jù)庫
[root@localhost ~]# /etc/init.d/mysqld stop Shutting down MySQL... SUCCESS!
2、啟動安全模式
[root@localhost ~]# mysqld_safe --skip-grant-tables --skip-networking & [1] 1475 [root@localhost ~]# 2020-01-18T14:07:12.861565Z mysqld_safe Logging to '/data/mysql/data_3306/localhost.err'. 2020-01-18T14:07:12.898677Z mysqld_safe Starting mysqld daemon with databases from /data/mysql/data_3306
3、登錄數(shù)據(jù)庫,修改密碼,報錯:沒有加載授權(quán)表
[root@localhost ~]# mysql -uroot -p123 mysql> alter user root@'localhost' identified by '123456'; ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
4、手工加載授權(quán)表
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> alter user root@'localhost' identified by '123456'; Query OK, 0 rows affected (0.00 sec)
5、重啟數(shù)據(jù)庫
[root@localhost ~]# /etc/init.d/mysqld restart Shutting down MySQL...2020-01-18T15:09:46.575313Z mysqld_safe mysqld from pid file /data/mysql/data_3306/localhost.pid ended SUCCESS!
3、 測試密碼
[root@localhost ~]# mysql -uroot -p123456 mysql>
總結(jié)
以上是生活随笔為你收集整理的MySQL8.0启动和关闭流程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 得到APP如何开发票
- 下一篇: font-awesome动态旋转图标