解决Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre一路踩过的坑,包括mysql启动问题
错误日志:[Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'hema_app.a.iid' which is not functionally dependent on columns in GROUP BY clause; this is..
错误日志:
[Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'hema_app.a.iid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
首先说下环境:
linux sentos7 + mysql5.7
出现的原因:https://blog.csdn.net/qq_34707744/article/details/78031413
参考解决的方式:https://blog.csdn.net/li1325169021/article/details/78344083
上面两个地址是我参考的。
本来在自己本地允许的sql没问题在Linux下就报错了。
linux的mysql中查询:select @@global.sql_mode
结果为:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
网上说去除ONLY_FULL_GROUP_BY,然后再set进去,执行:
set @@global.sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
或者是修改mysql的配置文件。
接下来就是重启mysql。
好了,踩坑之路开始。
linux的mysql关闭启动等命令:https://www.cnblogs.com/cuiguangpeng/p/9888879.html
关闭mysql:service mysql stop
关闭没问题,接下来是启动:service mysql start
然后报错:
Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
意思就是我启动的方式不对,然后我去查资料,说让我找到mysql.server文件然后添加到etc/init.d文件夹下。
参考资料:
https://blog.csdn.net/imliuqun123/article/details/83347081
https://zhidao.baidu.com/question/1244046803721553819.html
然后当我执行find ./* -name mysql.server的时候什么也没查询出来,然后我发现自己所在的目录不对,需要回到根目录查询。
然后根目录查询,又报错了:
find: ‘/run/user/1000/gvfs’: 权限不够 的解决办法
我也是醉了,我root都没权限,然后继续找资料:
https://www.cnblogs.com/chenmingjun/p/10311983.html
官方说这是一个bug[bug#615848],原因是FUSE文件系统和权限不配的问题,全局搜索时碰到它就会退出报错。
其实这个目录是空的,查不查都没关系。所以,以下解决方式比较简粗暴:
umount /run/user/1000/gvfs // 卸载该文件
rm -rf /run/user/1000/gvfs // 删除该文件
然后再启动还是报错:
Mysql启动错误:Please read "Security" section of the manual to find out how to run mysqld as root!
继续查资料:
https://www.jianshu.com/p/6f054faf04a4
启动方式不对,设置root用户为启动用户。
加入启动参数--user=[username]
配置my.cnf,加入user=mysql意思是使用用户名mysql运行mysqld服务器
然后执行命令:
mysqld --user=mysql --explicit_defaults_for_timestamp
然后再执行:
service mysqld status
总算是好了。好凌乱啊。。。。
运维的活真心作死啊。。。。。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)