Mysql – thesqldump for UNIX domain socket

backupdatabaseMySQL

I have setup a new mysql database with my webhosting provider and the hostname is not the default localhost it is localhost:/tmp/mysql5.sock

I think this is becuase they are moving from mysql 4 to mysql 5

My question is how do I use mysqldump to create a backup file of this database, what ever I try gives me wrong username or can not connect errors?

Best Answer

What you are referring to is called a UNIX domain socket.

A socket is an alternative communication method to TCP/IP.

You can point mysqldump to it with the following flag:

--socket=/tmp/mysql5.sock

Additionally you should update the socket location in your MySQL configuration - my.cnf.

Sockets are preferred over TCP/IP for local connections.

So if my.cnf is correct, then you shouldn't need to specify the location in the mysqldump command, or for other applications that utilise the MySQL configuration.

Related Topic