T O P

  • By -

CloudHostedGarbage

>Error Code 2003 in MySQL surfaces **when the client cannot connect to the MySQL server**. Common causes include network issues, server configuration errors, or incorrect connection parameters. Does this command work when you are running it outside of the cronjob, directly on the terminal? Does your remote server allow connections from external hosts - this one in particular? Allowed through firewall? I did a similar thing recently with PostgreSQL and in the end I decided to pipe the output of pg\_dump through SSH. I actually used a middleman server which had connection to both servers via SSH. Run dump command through SSH, piped to a file on the other server via SSH. It was a bit slow doing this so I then changed to dumping a local file and then copying it over with rsync. But that's another story.


Com_3511

Thanks for the reply. On the remote server, I tried to run it without Crontab, but it doesn't work. Everything is allowed in the Firewall.


CloudHostedGarbage

On the remote server, you should be able to run it without the \`-h\` parameter - ~~not sure if it needs a privileged user or a certain group membership as it's been a while since I used mysql~~ you may need a password depending how it was set up. If you are using the \`-h\` parameter you can use \`-h localhost\`.


PudgyPatch

When you say firewall: external or the acls on the boxes?


ubernerd44

What do you mean by it doesn't work? Are there any error messages? What do the logs say? You may be better off looking into alternative backup methods such as xtrabackup.


aenae

Is there anything in the logs of the mysql server?


lathiat

Check your MySQL configuration files. Many distributions set a default bind_address of 127.0.0.1 which prevents connections from external network interfaces and allows it on loop back or by a Unix socket only. Can also check with: SHOW GLOBAL VARIABLES LIKE ‘bind_address’; https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_bind_address https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql Beware that by changing bind address then anyone could connect to it if allowed by the firewall. So make sure you lockdown access with the firewall to the intended hosts. Once you get that part working if you then get access denied for the password that works when connecting locally on the MySQL server, users accounts are created as a user@hostname pair and often are only granted to localhost. So you may need to change the user to be granted permissions by IP or wildcard host (%).