问题
When i connect to my databse via phpmyadmin everything works fine and it shows me the data. When i am on my server i can see all data and work with it.
But when i try to connect to my server i'm getting this error:
com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (4.739.923 > 65.535). You can change this value on the server by setting the 'max_allowed_packet' variable.
im getting the max allowed packet size here:
Database changed
MariaDB [selforder]> SELECT @@max_allowed_packet;
+----------------------+
| @@max_allowed_packet |
+----------------------+
| 536870912 |
+----------------------+
1 row in set (0.00 sec)
and i changed my file nano /root/.my.cnf to this:
[mysqld]
max_allowed_packet=536870912
but i still get this error;
回答1:
You changed the max_allowed_packet
option in your MariaDB Server, but not for the client.
The client — that is, the JDBC driver in your case — also has a property for the max allowed packet. The actual limit on packet size is the lesser of the client's packet size limit and the MariaDB Server's packet size limit.
To change the client's property, use the configuration property maxAllowedPacket
in the JDBC URL.
jdbc:mysql://dbhost/mydatabase?maxAllowedPacket=536870912
来源:https://stackoverflow.com/questions/61028009/packet-for-query-to-large-setting-max-allowed-packet