MySQL Server Problem

athomas

Geek Trainee
Ok, one of my many linux servers will not allow SQL connections from the outside. I've created another full access user, it gives a 2003 connect error. This only happens on a remote machine. I am trying to connect with MySQL administrator. I am having this issue both within the same subnet, and on an outside network, with the port open, and connecting on port 3306. Telnet does not work within the network or outside.
 
nmap shows all the other services listening except mysql.
It sounds like mysql is setup to only listen on the loopback address. Look in your my.cnf file (will be in /etc/ on Red Hat-like systems, or in /etc/mysql/ on Debian-like systems) and see if you have a line like so:
Code:
bind-address            = 127.0.0.1
If so, you want to change the bind address to the actual address of the interface you want it to listen on. Or, you can just comment the whole line out by adding a # symbol at the beginning of the line and MySQL will listen on all interfaces by default. Then, restart mysql and all should be good. You can confirm with another quick nmap.

NOTE
: If you haven't set a root password on MySQL, please do so before opening up MySQL to the world! Also, it's a good idea to create a non-root user in which to run your databases anyway, so that the compromise of one site doesn't end up as a compromise of the entire server.
 
It shows bad username/password combo now, even though it's right.
I think I'm gonna need more info if you'd like more help. Logs from the MySQL server during the attempted connection would be sweet. Also, the actual error number would be good. MySQL actually has quite a robust error tome, and each one could point to a potentially obvious solution.
 
Oh, duh... just never messed with sql logs, didn't register right away.... log is below.


HTML:
080925  0:57:48 IM pid file: '/var/run/mysqld/mysqlmanager.pid'; PID: 3140.
080925  0:57:48 Angel pid file: '/var/run/mysqld/mysqlmanager.angel.pid'; PID: 3138.
080925  0:57:48 accepting connections on ip socket (port: 2273)
080925  0:57:48 guardian: starting instance 'mysqld'...
080925  0:57:48 starting instance 'mysqld'...
080925  0:57:49 accepting connections on unix socket '/var/lib/mysql/mysqlmanager.sock'
080925  0:57:50  InnoDB: Started; log sequence number 0 43655
080925  0:57:51 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.45'  socket: '/var/lib/mysql/mysql.sock'  port: 0  PCLinuxOS - MySQL Standard Edition (GPL)
080925  0:58:08 guardian: instance 'mysqld' is running, set state to STARTED.
080925  1:06:19 IM pid file: '/var/run/mysqld/mysqlmanager.pid'; PID: 3073.
080925  1:06:19 Angel pid file: '/var/run/mysqld/mysqlmanager.angel.pid'; PID: 3070.
080925  1:06:19 accepting connections on ip socket (port: 2273)
080925  1:06:19 guardian: starting instance 'mysqld'...
080925  1:06:19 accepting connections on unix socket '/var/lib/mysql/mysqlmanager.sock'
080925  1:06:19 starting instance 'mysqld'...
080925  1:06:21  InnoDB: Started; log sequence number 0 43655
080925  1:06:22 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.45'  socket: '/var/lib/mysql/mysql.sock'  port: 0  PCLinuxOS - MySQL Standard Edition (GPL)
080925  1:06:39 guardian: instance 'mysqld' is running, set state to STARTED.
080925 22:04:31 [Note] /usr/sbin/mysqld: Normal shutdown

080925 22:04:31  InnoDB: Starting shutdown...
080925 22:04:33  InnoDB: Shutdown completed; log sequence number 0 43655
080925 22:04:33 [Note] /usr/sbin/mysqld: Shutdown complete

080925 22:04:33 Listener_thread::run(): shutdown requested, exiting...
080925 22:04:34 IM pid file: '/var/run/mysqld/mysqlmanager.pid'; PID: 16931.
080925 22:04:34 Angel pid file: '/var/run/mysqld/mysqlmanager.angel.pid'; PID: 16930.
080925 22:04:34 accepting connections on ip socket (port: 2273)
080925 22:04:34 guardian: starting instance 'mysqld'...
080925 22:04:34 accepting connections on unix socket '/var/lib/mysql/mysqlmanager.sock'
080925 22:04:34 starting instance 'mysqld'...
080925 22:04:34  InnoDB: Started; log sequence number 0 43655
080925 22:04:34 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.45'  socket: '/var/lib/mysql/mysql.sock'  port: 0  PCLinuxOS - MySQL Standard Edition (GPL)
080925 22:04:54 guardian: instance 'mysqld' is running, set state to STARTED.
080926  0:20:50 [Note] /usr/sbin/mysqld: Normal shutdown

080926  0:20:50  InnoDB: Starting shutdown...
080926  0:20:51  InnoDB: Shutdown completed; log sequence number 0 43655
080926  0:20:51 [Note] /usr/sbin/mysqld: Shutdown complete

080926  0:20:51 Listener_thread::run(): shutdown requested, exiting...
080926  0:20:52 IM pid file: '/var/run/mysqld/mysqlmanager.pid'; PID: 10059.
080926  0:20:52 Angel pid file: '/var/run/mysqld/mysqlmanager.angel.pid'; PID: 10058.
080926  0:20:52 accepting connections on ip socket (port: 3306)
080926  0:20:52 guardian: starting instance 'mysqld'...
080926  0:20:52 accepting connections on unix socket '/var/lib/mysql/mysqlmanager.sock'
080926  0:20:52 starting instance 'mysqld'...
080926  0:20:52  InnoDB: Started; log sequence number 0 43655
080926  0:20:52 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.45'  socket: '/var/lib/mysql/mysql.sock'  port: 0  PCLinuxOS - MySQL Standard Edition (GPL)
080926  0:21:06 accepted mysql connection 1
080926  0:21:06 accepted mysql connection 2
080926  0:21:12 guardian: instance 'mysqld' is running, set state to STARTED.
080926  0:21:14 accepted mysql connection 3
080926  0:21:14 accepted mysql connection 4
080926  0:21:22 accepted mysql connection 5
080926  0:21:22 accepted mysql connection 6
080926  0:22:52 accepted mysql connection 7
080926  0:22:52 accepted mysql connection 8
080926  0:22:56 accepted mysql connection 9
080926  0:22:56 accepted mysql connection 10
 
Gives a 1045 error. Bad user/password. This happened after editing the my.cfg file. I removed the # from the IP line, changed it to the internal IP of the server.
 
There was nothing that said to create it for one IP or another. There was a root user in there, I bound the internal IP in the my.cfg file, and webmin can manage adding other users.
 
None of that seemed to be pertinant to what's going on.
I'm not trying to pawn you off on the docs, but that's a pretty comprehensive list of what can cause the problem you're seeing. I would look at it very closely, since the problem you're giving me is way to vague to help you much more than I have -- at least without having access to that box myself.
 
If anybody stumbles on this thread, the problems were manifold. Basically the passwords on the MySQL accounts weren't properly setup, and port 3306 was being firewalled. :)
 
Back
Top