Mysqldump error : Couldn’t execute ‘show table status

MySQLmysqldump

I have a database that I want to export. It has about 6 GB. PhpMyAdmin could not handle it, so after reading a little bit about it I am trying to do it from the console, unsuccessfully. When I run :

./mysqldump -u root -p mydatabase > /Users/myuser/Documents/mydatabase.sql

It gives me this error :

mysqldump: Couldn't execute 'show table status like 'USDT@002dXVG\_day'': Lost connection to MySQL server during query (2013)

Is someone encountered with the same problem ?

Best Answer

The database size itself is very big and that seems to be the reason of lost connection to mysql server.

You can try the below command which will try to take the backup after increasing the net_write_timeout and max_allowed_packet

mysql -u root -p -e "SET GLOBAL net_write_timeout=300; SET GLOBAL max_allowed_packet=1024*1024*1024;"

This command will increase the timeout and max_allowed_packet size. After this, run the below command to take the dump

./mysqldump -u root -p mydatabase > /Users/myuser/Documents/mydatabase.sql

If you still get error, please provide exact error you are getting in the mysql error logs.