时间:2021-07-01 10:21:17 帮助过:14人阅读
Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User=‘root‘;
mysql> flush privileges;
mysql> quit;
Stop MySQL Server:
# /etc/init.d/mysql stop
Start MySQL server and test it:
# mysql -u root -p
---------------------------------------------------------------------------------
如果上面的方法不行,那么使用下面的方法:
#service mysql stop or # /etc/init.d/mysql stop # 停止mysql服务
# mysqld_safe --skip-grant-tables --skip-networking # 执行该命令之后,然后再打开一个终端运行下面的命令
# mysql -u root # 不加 -p
mysql> UPDATE mysql.user SET Password=PASSWORD(‘new-root-password‘) WHERE User=‘root‘; # 修改root的密码
# service mysql start or /etc/init.d/mysql start # 启动mysql服务
重置mysql密码
标签:启动mysql ted pre 背景 serve nbsp class 打开 stack