持久层
MySQL
1130
Host is not allowed to connect to this MySQL server
错误原因是我们的MySQL不允许远程登录,所以远程登录失败了,解决方法如下:
- 在装有MySQL的机器上登录MySQL mysql -u root -p密码
- 执行
use mysql;
- 执行
update user set host = '%' where user = 'root';
- 执行
FLUSH PRIVILEGES;
2059
原因:mysql8之前版本中加密规则为mysql_native_password,mysql8以后的加密规则为caching_sha2_password,将mysql用户登录加密规则修改为mysql_native_password即可!
登陆数据库:输入mysql -uroot -p
输入你的数据库密码后即登录成功
输入 use mysql; 出现Database changed
输入select user,host from user; 目的为了查看user的root 对应host是什么 我的对应为localhost
修改加密规则:输入ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
注:第一个root为数据库用户名 第二个root为数据库密码 切记换成自己的用户名和密码
如果你查看到的root对应的host为% ,将该句改成ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
Mybatis-Plus
mybatis plus生成实体entity没有id (opens new window)
- 代码生成器中注释
strategy.setSuperEntityColumns("id");
1
上次更新: 2025/02/26, 08:57:57