cancel
Showing results for 
Search instead for 
Did you mean: 

Can't connect to local MySQL server errors

Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Can't connect to local MySQL server errors

I am trying to set up a script that will be called via Crontab to backup the mysql database tables on the rumpus server.
I keep getting these errors:
36 tables were optimized
/usr/bin/mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect
The mysql dump command is:
/usr/bin/mysqldump --skip-extended-insert --user martek --password=**************** martek_f9 | gzip
I think it may be a problem with paths but I am not sure.
I am using the mysqldump.php script version 0.6, By Richard Williamson (aka OldGuy).
the config variables are set to (password hidden):
$cfg[0]['dbhost'] = 'rumpus';  // your mySQL server name
$cfg[0]['dbuser'] = 'martek';  // your mySQL user name
$cfg[0]['dbpass'] = '****************'; // your mySQL password
$cfg[0]['dbname'] = 'martek_f9';
Can someone please advise me where I am going wrong.
4 REPLIES 4
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: Can't connect to local MySQL server errors

Just to confirm, are you running this on the PN CCGI server or your own *nix server?
If your own you need to use rumpus.plus.net
prichardson
Grafter
Posts: 1,503
Thanks: 1
Registered: ‎05-04-2007

Re: Can't connect to local MySQL server errors

The MySQL dump command quoted, neglects the MySQL server hostname. When this happens, it falls back to the unix socket approach, but fails as this is not used.
Are there any other settings to complete?
Got a link to the script involved, and I will see if I can see any cause.
Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: Can't connect to local MySQL server errors

Quote from: Peter
Just to confirm, are you running this on the PN CCGI server or your own *nix server?

Thanks for the reply Peter. I am running it from a php script on PN CCGI "crofters".
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: Can't connect to local MySQL server errors

As Phil suggests, it needs to have --host=rumpus in the mysqldump command line options