我再次需要你的帮助。我正在尝试将我的 java 网站放到网上。
我用什么:
- MySQL 服务器:命令行 mysql -V,结果:mysql Ver 15.1 Distrib 10.1.23-MariaDB,使用 readline 5.2 的 debian-linux-gnu (x86_64)
- 辣椒
- Debian 服务器
- 爪哇 (Vaadin)
查询数据包太大(4739923 > 1048576)。您可以通过设置 max_allowed_packet' 变量在服务器上更改此值。
我尝试了什么:
1.就像错误所说,我尝试通过执行以下操作更改服务器上的值:
- 登录我的服务器
- 使用以下命令连接到 MySQL:
mysql -u root
- 进入 :
SET GLOBAL max_allowed_packet=1073741824;
- 然后,使用以下命令重新启动服务器:
/etc/init.d/mysql restart
但我仍然有错误。
2.我看了看:如何更改 max_allowed_packet 大小
但是,当我这样做时nano /etc/mysql/my.cnf
,文件看起来像(我没有任何 [mysql]):
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Nov 10 23:57:02 2017 from 82.236.220.195
root@XXXX:~# nano /etc/mysql/my.cnf
GNU nano 2.7.4 File: /etc/mysql/my.cnf Modified
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
在 mysql 中,“mysql”文件夹中的文件夹/文件是:
任何提示将不胜感激!谢谢
编辑:在/etc/mysql/mariadb.conf.d/50-server.cnf
,我改变了:
max_allowed_packet = 1073741824
max_connections = 100000
我补充说:net_buffer_length = 1048576
EDIT2:现在,当我在服务器上的命令行中选择变量时,我有:
MariaDB [(none)]> SELECT @@global.max_allowed_packet;
+-----------------------------+
| @@global.max_allowed_packet |
+-----------------------------+
| 1073741824 |
+-----------------------------+
1 row in set (0.00 sec)
解决方案因为错误不明确。
感谢com.mysql.jdbc.PacketTooBigException
我的卡宴配置是:
<url value="jdbc:mysql://IPADDRESS:22/DBBASENAME" />
<login userName="ServerUserName" password="ServerPassword" />
但它应该是:
<url value="jdbc:mysql://IPADDRESS/DBBASENAME" />
<login userName="MYSQLUserName" password="MYSQLPassword" />