mysql -uroot -pmysql
输入设置的密码sql
居然报错了!数据库
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)网络
密码留空ide
仍是错误!rest
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)ip
因而重改密码!it
# /etc/init.d/mysql stoptable
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &class
mysql <-----登陆
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; <----修改密码
mysql> FLUSH PRIVILEGES;
假如忘记了登陆mysql的root用户的密码
#/etc/init.d/mysqld stop
手动启动数据库
#mysqld_safe --skip-grant-tables --skip-networking &
#mysql //登陆
(这种状况下,就不能使用grant来修改密码,只能用update来修改密码)
>update mysql.user set password=password('123456') where user='root'; //从新修改密码
#/etc/init.d/mysqld restart //重启数据库
skip-grant-tables //跳过赋权表
skip-networking //跳过网络