Metin2 "MySQL Server Has Gone Away" Error Solution
When the connection between the game files (game/db) and the database (MySQL/MariaDB) is broken on Metin2 PVP servers, the syserr.txt or Putty screen appears. "MySQL Server Has Gone Away" (Error Code: 2006) warning appears. When this error occurs, the server either does not open at all or the open channels (CH) are suddenly closed. You can follow the steps below to solve the problem completely.
Method 1: Increasing Package Size in `my.cnf` File (Most Effective Solution)
The most common cause of this error is that the data packet that the game server is trying to send to MySQL at once (e.g. when loading a large item_proto or player data) exceeds the maximum limit that MySQL allows. To increase the limit:
- Connect to your server with Filezilla or WinSCP.
- Generally in FreeBSD infrastructure
/var/db/mysql/or/etc/located in directory my.cnf Download the file to your computer and open it with a text editor. - in file
[mysqld]Add the following command lines under the tag (If any, update their values like this):max_allowed_packet = 64M wait_timeout = 28800 interactive_timeout = 28800
- Save the file and load it back to the server and restart the MySQL service via Putty with the following command:
service mysql restart
Method 2: Checking Database Timeout Settings
When the current player density on the server decreases or in-game queries take a long time, MySQL can automatically close idle connections. When your game files try to operate through this closed connection, they receive this error.
- What we added in method 1 above
wait_timeoutandinteractive_timeoutvalues avoid this problem by extending the time in seconds (28800 seconds = 8 hours) that the database waits before disconnecting.
Method 3: Cleaning Damaged and Swollen Log Tables
Tables in the log database in Navicat (Ex:log.command_log,log.shout_log) has reached excessively large sizes, MySQL may crash and disconnect during the query.
- Open the Navicat program and "log" Log in to the database.
- Right click on log tables that are too large and Empty Table Empty the tables with the (Truncate) option.
- After processing, select the tables completely and right click Maintain -> Optimize Tables do it.
Method 4: Server RAM and Swap Insufficiency
If the RAM capacity of your FreeBSD server is insufficient, the operating system can momentarily stop the MySQL service (mysqld) in the background (Kill operation) to protect high priority processes. via Puttytop -cCheck your RAM usage by typing . If RAM is at the limit, you need to upgrade your server package or reduce unnecessary CH numbers.
This article is specially prepared for PvPServer.