mysqldump error 2003 Can't connect to MySQL server ... (110) - mysql

I don't think this is a dup question as I have read other posts about error 2003 and none resolve my situation.
I have a bash script that executes mysqldump on a nightly basis against many tables in an Amazon RDS database. It has worked without issue for months, but recently, I've started seeing errors. Example results for a recent week:
Day 1: success
Day 2: success
Day 3:
TBL citygrid_state: export entire table
TBL ci_sessions: export entire table
mysqldump: Got error: 2003: Can't connect to MySQL server on 'blah' (110) when trying to connect
... wrlog crit forced halt
Day 4: success
Day 5:
TBL sparefoot.consumer_lead_action_meta: export entire table
TBL sparefoot.consumer_lead_action_type: export entire table
mysqldump: Got error: 2003: Can't connect to MySQL server on 'blah' (110) when trying to connect
... wrlog crit forced halt
Since the script works completely some nights and the calls to mysqldump work dozens of times before an error occurs, my thought is that I have a timeout problem. But where? Might it be a MySQL setting? Or does the issue lie elsewhere?
Some of the MySQL timeout settings:
connect_timeout 10
interactive_timeout 14400
net_read_timeout 30
net_write_timeout 60
wait_timeout 28800

Related

How to debug why phpmyadmin doesn't allow login to mysql when it was just working

I'm not sure what is happening or why this is happening so hopefully someone can give me tips on how to debug or where to look.
I have 2 docker containers, 1 for phpmyadmin and another for mysql. The phpmyadmin container is linked with the mysql container. When everything is/was working, I am able to log into my database thru the phpmyadmin login page with credentials I had setup.
However, and this has happened a couple times in the past already; yesterday I can log into mysql thru phpmyadmin, today when I try to log into mysql thru phpmyadmin, I'm not able to and I got a "Cannot log in to the MySQL server. mysqli::real_connect(): (HY000/2002): No such file or directory. I don't do anything to my host server and it happens.
Also, there doesn't seem to be a set pattern of time either. One time I was able to log in for 3 months before this happened, another time, it was 3 wks, and yet another time it was 6 days before I couldn't log in.
The funny thing is I can log into mysql via the cli after I log into the mysql docker container so mysql wasn't broken or down:
$ docker exec -it mysql /bin/bash
root#3752a707feb7:/# mysql --u username -ppwd
...
...
Your MySQL connection id is 12489
Server version: 8.0.23 MySQL Community Server - GPL
...
...
mysql> show databases
-> ;
+----------------------+
| Database |
+----------------------+
| information_schema |
| mysql |
...
...
+----------------------+
8 rows in set (0.03 sec)
mysql>
When I check my host and docker, I don't see any evidence the host or docker containers restarted.
$ w
16:16:59 up 160 days, 22:27, 3 users, load average: 0.02, 0.01, 0.00
...
...
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eead5d490e89 phpmyadmin "/docker-entrypoint.…" 3 months ago Up 3 months 0.0.0.0:8080->80/tcp myadmin
3752a707feb7 mysql:latest "docker-entrypoint.s…" 18 months ago Up 5 months 33060/tcp, 0.0.0.0:33060->3306/tcp mysql
...
...
$ docker events --since '2022-05-01' | grep eead5d490e89
(Doesn't show any container restarts or container destroys. I can put the log lines here if needed but it was A LOT of log lines)
The "fix" I did before was to just restart the phpmyadmin container and tell it to reconnect to mysql. I'd like to avoid doing this if possible and figure out what is making it disconnect in the first place.
What else can I check to see why from time to time the phpmyadmin docker container doesn't allow me to log into the mysql docker container?
I've had this error, I changed my port to 8080 and it worked
Are you trying to initialise mysql-server with any database? I have observed that in case a heavy sql file is loaded to mysql-server, it requires time to complete the import process before it becomes accessible through remote login.

mysql restore 2013 Lost connection to the mysql server

I did a backup. The dump is 240 GB. This is the command that I executed
mysql -u dba -p < XXX.sql
After 1 hours of the restore I had this error
'2013 Lost connection to the mysql server during the query'
After google I changed this 2 paramet
max_allowed_packet = 2148M and net_write_timeout = 10000
But unfortunatelly I always the same errors.
I also tried to add this config in the my.cnf innodb_force_recovery = 1
I had the error
Error 1036 at ine 2863: Table XXX is read only
Thanks you in advance for your help

MySQL Dump Error: Lost connection to MySQL server

I have a problem with my SQL database.
My RAID failed but I recover data from the drive and now I have my old database, but it is full errors. I want to export it to SQL file and import it to new RAID and drives. ¨
But when I tried to dump it wit this command:
root#LFCZ:/home# mysqldump -u root -password mc | gzip -9 > mc.sql.gz
It gives me this Error:
mysqldump: Got error: 2013: Lost connection to MySQL server during query when using LOCK TABLES
Can you help with that? Only thing I need is to get .sql file. It is a very big database (approx. 13 GB) but It is running on OVH dedicated server, so it is powerfully enough.

Error 2013 in MySQL export database

my MySQL server was working fine, but today I can't connect to this. I get the error "Can't connect to mysql server on 'localhost' (10061)". So I check that the Mysql55 service in my Windows 7 x64 is stopped. I start the service, but when I open a specifically database the server stops. With other databases I don't have any problem.
I try to dump the database to a .sql file and I get the error "mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table table_name at row: 43795". Then the server stops. I try this Error Code: 2013. Lost connection to MySQL server during query but not works.
When I try to export the database in other times, I get the same error, but with a different row value.
It seems while dumping the particular table sending receiving too large data from that table .
use --max_allowed_packet=500M and then dump it..also check your my.ini config file max_allowed_packet variable size you have specified .

MySQL Import 4GB+ SQL on MySQL 5.6

I’m trying to import a 4GB+ SQL to MySQL 5.6 (64-bit) on Windows 7 (64-bit)
The problem is I after a few seconds (), get this message:
ERROR 2006 (HY000) at line 204: MySQL server has gone away
It does import, but it only the first 3 tables (the first 2 and the 3rd table just the structure.
I’ve been trying this command:
mysql -u root -p firedb < C:\database_2013-11-12.sql
I tried a lot of things I could find here on stackoverflow with no success yet:
[mysqld]
innodb_file_per_table
max_allowed_packet=2048M
wait_timeout=3600
net_read_timeout=3600
net_buffer_length=3600
The SQL file was created on “MySQL 5.1.72-2-log (Debian)” using this command:
mysqldump -u root -p --all-databases
I have also tried setting --max_allowed_packet when running the command like this:
mysql --max_allowed_packet=2048M -u root -p --all-databases
The Documentation states:
The most common reason for the MySQL server has gone away error is
that the server timed out and closed the connection.
By default, the server closes the connection after eight hours if
nothing has happened. You can change the time limit by setting the
wait_timeout variable when you start mysqld. See Section 5.1.4,
“Server System Variables”.
If you have a script, you just have to issue the query again for the
client to do an automatic reconnection. This assumes that you have
automatic reconnection in the client enabled (which is the default for
the mysql command-line client).
So i would start with increasing the timeout.
And if this does not help read int he attached documentation link for the rest of reasons for server has gone away error.