Heim  >  Artikel  >  Datenbank  >  mysql ERROR 1045 修改密码二种方法

mysql ERROR 1045 修改密码二种方法

WBOY
WBOYOriginal
2016-06-07 17:51:141228Durchsuche

现现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>

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn