mysql rpm安装后的密码修改_MySQL

WBOY
Release: 2016-06-01 13:10:18
Original
918 people have browsed it

由于在fedora下用 mysql官方源安装myslq后,root用户密码为随机生成,没找到默认密码文件在哪里,导致找不到方法进入数据库。


以下是解决过程,记录下来以备后患:

解决mysql“Access denied for user 'root'@'localhost'”
我的系统是ubuntu6.06,最近新装好的mysql在进入mysql工具时,总是有错误提示:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

还是不行。

使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'

悲剧啊!!

最后找到了解决方法,如下(感谢网络,谢谢!):
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

输入mysql -u root -p

输入新修改的密码成功登录。


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!