【发布时间】:2018-04-06 09:59:24
【问题描述】:
自从我从 Windows 转移到 Ubuntu 后,我无法再启动我的 Java Spring MVC 应用程序了。无法建立 MySQL 数据库连接。在迁移到 Ubuntu 之前,我的数据库连接没有任何问题(而且我没有更改代码)。
我的工作:
我的 Spring 应用使用以下连接字符串:
jdbc:mysql://localhost:3306/mydatabase?user=mydbuser&password=mypassword
错误是什么:
Spring 只告诉我没有数据库连接。但是当我查看数据库日志时,我可以看到以下错误:
Aborted connection 6 to db: 'mydatabase' user: 'mydbuser' host: 'localhost' (Got an error reading communication packets)
我已经尝试过的:
我可以使用mydbuser 通过 MySQL 控制台登录。数据库已存在,我的用户拥有所有权限。连接问题仅存在于 Spring 应用程序中。
我遵循了许多来自 stackoverflow 的建议,例如设置以下变量:
SET @@global.log_error_verbosity = 2;
SET @@global.max_connections = 400;
SET GLOBAL max_allowed_packet = 1024 * 1024 * 256;
你有什么想法我可以尝试或问题是什么?
【问题讨论】:
标签: mysql spring-mvc