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