1、问题:ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
分析:一般是密码错误引起的,修改root密码;
解决:
1) vim /etc/my.cnf(注:windows下修改的是my.ini) 2) 在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程 3) 重启MySQL,/etc/init.d/mysql restart(有些用户可能需要使用/etc/init.d/mysqld restart) 4) 进入mysql,mysql -uroot 5) 修改密码: mysql> use mysql; mysql> update user set password=password("你的新密码") where user="root"; mysql> flush privileges; mysql> quit 如果出现: mysql> show databases; Ignoring query to other database 则说明进入mysql的时候,账号前面没带-u,需要加上-uroot
2、问题:ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’
分析:错误的原因是 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string;
解决:
mysql> update user set authentication_string = password('123456') where user="root";
3、授权;
grant all privileges on *.* to root@'%' identified by '123456' with grant option; flush privileges;
转载请注明:永盟博客 » mysql常见问题汇总