You should not need to rebuild MySQL. Most likely, it is a configuration issue. Without knowing what your configuration is like (what OS, what Linux distro, what version of MySQL, what kind of network configuration, etc.) the following might not apply to any issue you face. Here is some general MySQL connection issue trouble shooting steps I wrote, starting from the simplest. Give it a try, and let me know if it helps.
Disclaimer: The examples are verified on RHEL/CentOS 5.5 with MySQL 5.0 installation. For the most part, I tried to keep it Linux distro independent if I can. It might even apply to BSD, or MacOS X. However, if you are running MySQL on Windows, sorry I cannot help. In any case, as they said, YMMV (your mileage might vary).
General MySQL Connection Trouble Shooting Steps:
1. Make sure the server you are connecting to is up and running:
ps ef | grep mysql
Do you see mysqld_safe, or mysqld running? If not, start mysql daemon:
service mysqld start
Otherwise, see MySQL doc (e.g. for MySQL 5.0) for your OS at
if you don't know how to start MySQL server.
2. Is your MySQL listening to the port you are trying connect? Default port is 3306. Do a
netstat -an | grep 3306
would verify that. Check your /etc/my.cnf file should tell you what port it is running on if it is not default port. Check with your admin if you cannot view the config file. If you can confirm that it is a non-standard port, make sure that you are connecting with that port, say, for example,
mysql --host <host> --port <number> --user <username> --password
3. Check to make sure you can connect from where you are connecting. Check your /etc/my.cnf file (it might be at a different location for different OS) and see if you have a statement like this:
If it is there, you have a problem connecting to mysql from anywhere other than localhost. You need to comment that out. That would allow all system to connect to mysql server. You need to secure mysql server with firewall rules. E.g.
Check with your network admin or read up on iptables tutorial if you don't know how.
4. Make sure your server firewall is not blocking access:
If you are not sure, a quick way is to flush the iptables rules first:
and see if that fix the problem. If it does, you can then add the rule you need to allow access. e.g.
iptables -IINPUT -p tcp --dport 3306 -s 192.168.1.100 -j ACCEPT
If you are connecting from, say, 192.168.1.100 via the default port.
5. Does your server allow the user you are using to connect from where you are connecting it from? From the server, get in as root
mysql --user root --password
assuming that you already set mysql root account password since you are concerned about security. Do the following sql select:
mysql> select Host, user, password from mysql.user;
You can vary the select statement if you want to limit the result. If you are connecting using username mysqlluser from say, 192.168.1.100, and you don't see that come up. The simplest way to grant access is do this:
mysql> GRANT SELECT, INSERT, UPDATE, CREATE, DROP, RELOAD, SHUTDOWN, ALTER, SUPER, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'mysqluser'@'192.168.1.100';
You might want to tailor the privilege you grant by your need.
Mmm.... I think that covers a lot of ground for connection problems. Cannot think of what else can go wrong now. Give it a shot, and see what you can do with it. Let us know whether it works for you or not. If you still have problem, some specific of your installation might help.
Sorry that I am new to the forum. Need to figure out how to format it better. I'll try to add HTML tag next time.
Open Source Enthusiast