linux ubuntu系统 ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)数据库错误
这个错误一般是登陆密码错误导致的问题
登陆时报错:
1.首先在 /etc/mysql/mysql.conf.d 目录下找到f文件
使用sudo vim f 命令打开文件,注意要使用sudo,因为修改该文件要root权限
2.打开文件后在[mysqld]的下面添加skip-grant-tables
3.添加完成后保存退出重启mysql服务
重启服务:sudo service mysql restart
4.重启后免密码重新登陆
在输入密码的时候直接enter就可以登陆
5.最后修改密码
(首先更新权限)flush privileges
(修改密码)ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘新密码’;
quit;或者exit;退出
使用sudo vim /etc/mysql/mysql.conf.d/f命令把[mysqld]中添加的skip-grant-table删除
重启MySQL输入刚设置的密码,完成登陆