【技术方案】MySQL8常用问题解决方案
-
部署到运行环境后找不到表名
# Linux环境默认大小写敏感find / -name my.cnf# 编辑查找到的my.cnf文件在my.cnf文件中的[mysqld]下加入一行:lower_case_table_names=1# Windows默认大小写不敏感
数据库还原失败
# 修改Server接受的数据包大小show VARIABLES like '%max_allowed_packet%';show VARIABLES like '%max_allowed_packet%';set global max_allowed_packet=10000000000;# linux中修改以下配置my.cnf的max_allowed_packet = 20M
Group By语句错误
# 版本问题导致的Group By 精确匹配问题# 方案1jdbc.url=jdbc:mysql://ip:port/dbname?useUnicode=true&characterEncoding=utf-8&sessionVariables=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# 在数据库执行set sql_mode语句或者在my.conf中配置
MYSQL8错误信息:The user specified as a definer ('root'@'%') does not exist
use mysqlselect host,user from user;update user set host='%' where user='root';
