mysql -u root 错误提示:ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO) 登录root帐号需要密码,就是忘记密码的操作了。
1.在/etc/my.cnf文件中添加skip-grant-tables。
2.重启mysql,service mysqld restart
3.登录mysql,# mysql -u root
4.修改密码,
mysql>use mysql;
mysql>update mysql.user set authentication_string=password('密码') where user='root';
mysql>flush privileges;
mysql>exit;
5.恢复/etc/my.cnf,将skip-grant-tables删除或者注释掉。
6.重启mysql,service mysqld restart
ok
mysql 5.7 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonag
1.找到/etc/my.cnf 文件增加以下代码
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
2.重启mysql
service mysql restart
3.设置
mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
ok