2016-06-13 131 views
0

我试图按照所有建议here但没有为我工作。我已经在Fedora上安装了mysql社区服务器mysql-community-server-5.7.9-1.fc21.x86_64MySQL无法重置“root”密码

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

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

当我执行mysqld_safe的--skip-赠款表

2016-06-14 10:46:00 3495 mysqld_safe: Logging to '/var/log/mysqld.log'. chown: invalid user: ‘@[email protected]’ 2016-06-14 10:46:00 3495 mysqld_safe: The file @[email protected]/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的用户密码我得到这个错误。请帮忙。

+0

您是否尝试过无密码访问? 'mysql -uroot' –

+0

此外,请参阅:http://stackoverflow.com/a/19229842/1911755 –

回答

0

RESET MySQL root密码(对于Linux用户)

登入根用户和运行

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 

-------------------- - 已完成----------

+0

这不是“恢复”密码;它只是设置一个不存在的地方。如果root用户具有未知密码,则“登录到新终端(使用root用户)”步骤将不起作用。 –

+0

我收到错误'mysqld_safe command not found' – Coder

+0

您可能需要登录您的Linux机器的root用户,那么您将能够访问所有mysql命令 –