Home > Database > Mysql Tutorial > body text

mysql ERROR 1045 修改密码二种方法

WBOY
Release: 2016-06-07 17:51:14
Original
1261 people have browsed it

现现1045是用户名与密码对不上号,也就是忘了密码,下面我们提供二种关于修改密码的解决办法,有需要的朋友可以参考一下。

直接使用/etc//debian.cnf文件中[client]节提供的用户名和密码:

 代码如下 复制代码
# mysql -udebian-sys-maint -p
Enter password:
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password:
mysql>


方法二

 代码如下 复制代码

# /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
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password:
mysql>

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template