繁体   English   中英

MySQL无法重置“ root”密码

[英]MySQL unable to reset 'root' password

我尝试遵循此处的所有建议但没有一个对我有用。 我已经在Fedora上安装了mysql社区服务器mysql-community-server-5.7.9-1.fc21.x86_64

我试图使用sudo grep 'temporary password' mysqld.log password'mysqld.log访问临时密码,但是它不返回任何密码。

我不断收到错误Access denied for user 'root'@'localhost' (using password: NO)

我执行mysqld_safe --skip-grant-tables时收到此错误

2016-06-14 10:46:00 3495 mysqld_safe: Logging to '/var/log/mysqld.log'. chown: invalid user: '@MYSQLD_USER@' 2016-06-14 10:46:00 3495 mysqld_safe: The file @libexecdir@/mysqld does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information

我不能重新设置root的用户密码。 请帮忙。

对于centos上的mysql 5.7

systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld
mysql -u root
mysql> use mysql; 
mysql> update user set authentication_string=password('you new pass') where 
user='root';
mysql> flush privileges; 
mysql> exit

systemctl restart mysqld

重置MYSQL根密码(对于Linux用户)

登录到root用户并运行

Step 1# /etc/init.d/mysql stop 
Step 2# mysqld_safe --skip-grant-tables & 
Output : Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6025]: started

Step 3 Login to new terminal (with root user)

   [#] mysql -u root

mysql> use mysql; 
mysql> update user set password=PASSWORD('NEW-ROOT-PASSWORD') where User='root';
mysql> flush privileges; 
mysql> quit

Step 4 # Stop MySQL Server:

/etc/init.d/mysql stop

Step 5 # /etc/init.d/mysql start

mysql -u root -pNEWPASSWORD

---------------------完成----------

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM