I'm trying to connect to a mysql server over a local network. The server is running and listening to post 41322.

dylan~$ netstat -ln | s mysql
unix  2      [ ACC ]     STREAM     LISTENING     41322    /var/run/mysqld/mysqld.sock

My user is granted all rights from all addresses, and I can log in locally.

dylan~$ mysqladmin -P 41322 -h dylan@ create database test
mysqladmin: connect to server at 'dylan@' failed
error: 'Unknown MySQL server host 'dylan@' (1)'
Check that mysqld is running on dylan@ and that the port is 41322.
You can check this by doing 'telnet dylan@ 41322'

Adding a --verbose flag gives no additional output. I've commented out bind-address= in /etc/mysql/my.cnf on the server. I can ssh into the server without a problem.

dylan~$ ps a | grep mysql
11131 pts/3    S      0:00 /bin/sh /usr/bin/mysqld_safe
11170 pts/3    Sl     0:03 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
11171 pts/3    S      0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
13710 pts/1    S+     0:00 grep mysq

Any help or thoughts are appreciated.

  • 2
    I'm not sure that the user@host syntax is valid. Try -h host -u user -p pass – fab Mar 19 '11 at 20:40
  • you netstat line indicates that mysql is listening on a unix socket (pipe), not a TCP socket. 41322 is an inode number in that case, not a TCP port. – Mat Mar 19 '11 at 20:55

It looks to me like your mysql daemon is not listening on a TCP port. Your netstat output shows that mysql is listening on a UNIX domain socket at inode 41322 (file /var/run/mysqld/mysqld.sock).

You didn't mention your OS, but I'm assuming Linux by your use of the -l flag to netstat. To show all listening TCP and UDP ports and the daemons using them on Linux, run netstat -ltunp

Some default MySQL installs have "skip-networking" in the config file, usually /etc/my.cnf or /etc/mysql/my.cnf. Comment that option out if it's present and restart the daemon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.