patternsqlMinor
How does one change the default socket used by mysqladmin?
Viewed 0 times
theusedmysqladminonedefaultdoeshowsocketchange
Problem
How does one change the default socket used by mysqladmin?
I don't see a section for
It tries by default to connect to
I know you can specify the socket at the command line, such as:
How do I change the default socket used by mysqladmin so I don't have to specify my non-standard path each time?
I don't see a section for
[mysqladmin] in /etc/my.cnf. It tries by default to connect to
/tmp/mysql.sock, however, this is not the socket that my MySQL server uses, so I get the error:error: 'Can't connect to local MySQL server through
socket '/tmp/mysql.sock'I know you can specify the socket at the command line, such as:
mysqladmin --socket='/some/other/path/mysql.sock'How do I change the default socket used by mysqladmin so I don't have to specify my non-standard path each time?
Solution
Add a [mysqladmin] section in your
You should be able to figure it out from what's shown below:
/etc/my.cnf or $USER/.my.cnf and set the socket. This will override the compiled-in socket and the socket defined in the [mysqld] section.You should be able to figure it out from what's shown below:
VM52-CentOS58[root@ivdb41 ~]# mysqladmin ping
mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql2.sock' (2)' Check that mysqld is running and that the socket: '/var/lib/mysql/mysql2.sock' exists!
VM52-CentOS58[root@ivdb41 ~]# grep -A 1 mysqladmin /etc/my.cnf
[mysqladmin]
socket=/var/lib/mysql/mysql2.sock
VM52-CentOS58[root@ivdb41 ~]# mysqladmin ping mysqld is alive
VM52-CentOS58[root@ivdb41 ~]# grep -A 1 mysqladmin /etc/my.cnf
[mysqladmin]
# socket=/var/lib/mysql/mysql2.sockCode Snippets
VM52-CentOS58[root@ivdb41 ~]# mysqladmin ping
mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql2.sock' (2)' Check that mysqld is running and that the socket: '/var/lib/mysql/mysql2.sock' exists!
VM52-CentOS58[root@ivdb41 ~]# grep -A 1 mysqladmin /etc/my.cnf
[mysqladmin]
socket=/var/lib/mysql/mysql2.sock
VM52-CentOS58[root@ivdb41 ~]# mysqladmin ping mysqld is alive
VM52-CentOS58[root@ivdb41 ~]# grep -A 1 mysqladmin /etc/my.cnf
[mysqladmin]
# socket=/var/lib/mysql/mysql2.sockContext
StackExchange Database Administrators Q#24281, answer score: 2
Revisions (0)
No revisions yet.