Execute SQL - ERROR 2013 (HY000) When uploading DB

SYSTEM INFORMATION
OS type and version: Ubuntu Linux 20.04.3
Webmin version: 1.981
Virtualmin version: 6.17-3
Related products version: MySQL 8.0.27-0

Hello Everyone!

From few days I have a problem when I try to upload WordPress DB in “Run SQL from file” option:

Output from uploaded SQL commands …
ERROR 2013 (HY000) at line 4043 in file: ‘/tmp/.webmin/114015_75977_1_exec_file.cgi’: Lost connection to MySQL server during query

After operation ends, data in tables look OK but when I try to edit some page in Elementor, then I can’t save changes becouse of 500 server error.

This site is being migrated from MySQL 5.7.36 (Ubuntu 18.04). I have migrated many other similar sites to Virtualmin with no problem in the past. My impression is that this problem started to occur after the last MySQL update from version 5.7.35 → 5.7.36 on the old server and from 8.0.26 → 8.0.27 on the new one.

Any ideas on how to fix it?

@Michal-pl,

How much CPU and Memory does this server or VPS have?

16GB RAM and 4 CPU 2,4GHz - it’s OVH VPS

@Michal-pl,

The system definitely seems to have plenty of system resources. Perhaps they are not properly delegated to the task, that is uploading the file via Webmin (which I assume you are doing) may be the culprit or MySQL based on the error message may not be setup to make use of enough resources causing the session to timeout before completion.

I suspect in terms of the 500 error that the import of data is NOT completing so when you try to use Elementor it is failing.

Have you tried uploading the SQL file to the server directly, then running the import via the command line?

When I try to upload a DB from the command line with:
mysql -u root -p testdb < dbname.sql

The error is the same:
ERROR 2013 (HY000) at line 4043: Connection to MySQL server lost during query

But when I try to upload the same DB back to old 5.7.36 server - everything is OK.

Config of MySQL 8.0.27:
innodb_buffer_pool_size = 1073741824
innodb_log_file_size = 268435456
disable_log_bin
connect_timeout = 60
key_buffer_size = 384M
myisam-recover-options = BACKUP
log_error = /var/log/mysql/error.log
max_binlog_size = 100M
innodb_file_per_table = 1
thread_cache_size = 8
myisam_sort_buffer_size = 64M
read_rnd_buffer_size = 8M
read_buffer_size = 2M
sort_buffer_size = 2M
table_open_cache = 20000

Before the problem started, I migrated 20 WP pages from the same old server without any problems and 60 more to a second VPS with the same configuration. DB sizes are not very big, usually 8MB - 100MB.
Interestingly, the broken connection error does not occur with all DBs, only those that have the Elementor plug installed.

Would it not be better to keep same version on new server 5.7.36 then upgrade to 8.0.27 after the migration?

Finally, I found a solution.

The problem appeared after updating MySQL 5.7.36 from 5.7.35 in cooperation with phpMyadmin 5.0.4 - in this case, exporting the database from phpMyadmin causes some crashes in its structure.

Downloading the database with mysqldump in the console allows to get a complete file that can be imported into Virtualmin without error.

I would like to thank everyone for quick answers and provided help!

That’s great. I assumed from reading you had done the dump via shell and not phpadmin. Glad you fixed it!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.