文章目录
1. SSL无服务证书警告
Sun Mar 15 00:25:15 CST 2020 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
数据库连接时:添加useSSL=false
spring:
datasource:
url: jdbc:mysql://localhost:3306/graduation_design?serverTimezone=UTC&useSSL=false
2. 1064 - 再三检查语法没问题,可能是关键字冲突导致
3. 1215 - 不能添加外键约束
① 查看数据类型是否一致
② 如果你需要设置主外键的setNull,则查看列是否是能为null
4. 单表不可group by
打开mysql配置文件 my.cnf 或者 my.ini - 添加下列配置即可
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
5. 1418 - 函数(自定义函数、存储过程)声明不确定
由于主从复制的原因。导致如果函数的返回值不是确定的,很可能会导致主数据库与从数据库之间的数据不一致。( log-bin变量开启 )
强制开启可创建函数 - 即可解决
SET GLOBAL log_bin_trust_function_creators = 1;
6. 1130(ip被限制登录)、1045(拒绝登录)
步骤1. mysql配置文件 - 添加下列配置
# 账号登录无需密码 - 主从复制的时候必须把这个配置去掉的哦!
skip-grant-tables
步骤2. 进入mysql
mysql -uroot -p随意字符
use mysql
#user表时复合主键(user、host)
select user,authentication_string,host from user;
# 更新用户密码 - 1045错误解决
UPDATE user
SET authentication_string = PASSWORD('root'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
# 更新用户访问ip - 任何host都可以访问该数据库 - 1130错误解决
update user set host='%' where user='root';
# 千万别忘这一步 - 刷新
flush privileges;
步骤3. mysql配置文件 - 删除下列配置
skip-grant-tables
步骤4. 重启服务即可用密码登录了
mysql -uroot -proot;