时间:2021-07-01 10:21:17 帮助过:318人阅读
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、登录数据库,修改密码,报错:没有加载授权表
[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、手工加载授权表
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、重启数据库
[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>
MySQL8.0启动和关闭流程
标签:pre 过程 down style tar 关闭数据库 tab res alter