我再次需要您的幫助。 我想把我的java網站在線。當我試圖在我的網站上進行查詢時出現'查詢包太大'
我用什麼:
- MySQL服務器:命令行的mysql -V,結果:MySQL的版本15.1 DISTRIB 23年1月10日,MariaDB的,使用readline的Debian的Linux-GNU(x86_64的) 5.2
- 卡宴
- 的Debian服務器
- 的Java(Vaadin)
查詢分組過大(4739923> 1048576)。您可以通過設置max_allowed_packet的變量來更改服務器上的此 值。
我的嘗試:
像錯誤說,我試着做更改服務器上的值:
- 登錄我的服務器
- 上連接到MySQL:
mysql -u root
- 輸入:
SET GLOBAL max_allowed_packet=1073741824;
- 然後,重新啓動服務器:
/etc/init.d/mysql restart
但我仍然有錯誤。
2.我接過一看:How to change max_allowed_packet size
但是,當我做了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
[email protected]:~# 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" />
Hi @Rick James,謝謝你的幫助。但是,我認爲我做了你所說的。第一點:'在my.cnf中修改',我嘗試過,但是就像我說過的,我沒有任何[mysqld],我把你寫在'my.cnf'中的相同行寫入並重新啓動它:沒有成功。然後,你說,把一個文件放在'/ ect/mysql/mariadb.conf.d'下,就像我在我的帖子中說的那樣,我編輯'50-server.cnf'。我應該創建一個新文件嗎?如果是的話,應該是什麼文件名?謝謝 – Bob
假設'... d'是一個目錄,創建你喜歡的任何文件名(我使用我的名字首字母+'.cnf'),並將其中的2行。 '50-server.cnf'應該沒問題。 –
不工作:(當我把它放在一個新的bob.cnf中時,我沒有任何改變(我仍然有錯誤)。這很奇怪,不是嗎? – Bob