将项目打包在linux上运行出现的问题解决方案

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/lucasmaluping/article/details/102477171

1、无法登录

因为在SpringBoot项目中的MyBatis配置中设置的数据库的地址为localhost,需改成安装mysql的主机的IP地址

2、本地无法连接远程服务器(Host is not allowed to connect to this MySQL server)解决办法

由于当前的root用户限制在当前的内网ip内访问的,需要修改他的访问域

mysql> use mysql
Database changed
mysql> select host from user where user = 'root';
+-----------+
| host      |
+-----------+
| localhost |
+-----------+
1 row in set (0.00 sec)

mysql> update user set host = '%';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> select host from user where user = 'root';
+------+
| host |
+------+
| %    |
+------+
1 row in set (0.00 sec)

最后cmd命令行 

net stop mysql...

net start mysql...

重启服务

mysql的名字需要到服务中查一下有可能是mysql80

命令行  services.msc打开服务查看

或者直接在服务中手动重启

猜你喜欢

转载自blog.csdn.net/lucasmaluping/article/details/102477171