原因:
https://blog.csdn.net/fansili/article/details/78664267
解决办法:
1:查看mysql配置文件位置
[root@localhost ~]# ps -ef | grep mysql mysql 838 1 0 02:21 ? 00:00:00 /usr/sbin/mysqld --defaults-file=/etc/my.cnf root 2035 1706 0 02:29 pts/0 00:00:00 grep --color=auto mysql
2:打开配置文件
[root@localhost ~]# vim /etc/my.cnf
3:修改配置:如果没有该配置项,添加一个即可
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
4:重启mysql
[root@localhost ~]# systemctl restart mysql