4

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 [email protected] create database test
mysqladmin: connect to server at '[email protected]' failed
error: 'Unknown MySQL server host '[email protected]' (1)'
Check that mysqld is running on [email protected] and that the port is 41322.
You can check this by doing 'telnet [email protected] 41322'

Adding a --verbose flag gives no additional output. I've commented out bind-address=127.0.0.1 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
  • 2
    I'm not sure that the user@host syntax is valid. Try -h host -u user -p pass
    – fab
    Mar 19, 2011 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, 2011 at 20:55

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .