MySQL Database Moved to Another Server but Socket Points to Localhost

amazon ec2amazon-rdslinuxMySQL

I know I shouldn't bother with this, maybe I should disable the old mysql, but this is a Magento virtual appliance from Bitnami thats work as a whole (application and database on the same server).

I had to follow the client's design, though, and take the mysql database to an Amazon RDS instance. (the magento/application server is an EC2 at amazon as well).

The application server has a script that starts up mysql, apache and some other stuff. In this process, it always tries to update the mysql database with any new data the server has (like DNS, hostname, IP Addresses). But since the database isn't there anymore, it fails on doing so.

I never found a way to change the configuration of mysql.sock. I would just reconfigure it and point to the new server with appropriate credentials but I can't find anywhere in the internet how to do so.

I could just forget the old mysql, but any changes I make will have to be manually updated in the remote server, and I fear this script is controlling a lot of other stuff I don't control.

In short, my issue is: mysql.sock points to wrong database. How could I change this?

Thanks for the interest!

Best Answer

It is a socket file used for inter-process communication, you have to stop the local MySQL server and make sure the mysql.sock doesn't exist. Then you have to re-create the socket file to send the connection to the correct destination (in your case, it is Amazon RDS).

There are many ways to create a socket file, for example you can use socat, and the command is (you may have to modify to your settings) -

socat UNIX-LISTEN:/path/to/mysql.sock,fork,reuseaddr,unlink-early,user=mysql,group=mysql,mode=777 TCP:<Amazon RDS Server>:3306 &

Source: http://linux.die.net/man/1/socat

Note: This isn't the right way to fix this, so you may want to check the bnconfig script to get a proper fix.