Problem
Sometimes you need to connect to mysql server with a UNIX socket, rather than a Port.
Generally this is when running multiple versions, on a box when you do not want to
or cannot connect to multiple ports.
Solution
If you want to connect to the mysql server from the command line, you can use -S.
Or within Perl – append mysql_socket to the dsn
Example
mysql -uUSER -pPASSWORD -S /tmp/mysql.sock
dbi:mysql:database=database_name;mysql_socket=/tmp/mysql.sock
Where your socket is /tmp/mysql.sock
Reference
[tags]MySQL, Socket, UNIX, Perl, Perl Coding School[/tags]