question about socket

Hi,

The default socket path for MySQL 5.6 is ‘/tmp/mysql.sock’.
http://dev.mysql.com/doc/refman/5.6/…_mysqld_socket

So if you have non-default socket place specified in my.cnf ([mysqld] section) then you can connect to mysql by the following ways:

  • specify socket explicitly in connection string:
    mysql -u root -p -S /var/lib/mysql/mysql.sock

OR

  • add the socket info to [client] section in my.cnf (and restart mysql) so your config file will be looking like below:
    [mysqld]

    socket = /var/lib/mysql/mysql.sock

[client]

socket = /var/lib/mysql/mysql.sock

In this case you’ll be able to connect w/o specifying socket, like below:
mysql -u root -p

That’s because:

  • socket in [mysqld] - the path where server will place a .sock file
  • socket in [client] - the path where will be looking for .sock file while connecting

By default both variables are ‘/tmp/mysql.sock’

You can read more related info there:
[URL=“MySQL :: MySQL 5.6 Reference Manual :: 4.2.2.2 Using Option Files”]http://dev.mysql.com/doc/refman/5.6/...ion-files.html[/URL]