Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In remote mysql 5.5 server I tried to add

bind-address = 11.22.33.44

Where bind-address = 127.0.0.1 has commented out and 11.22.33.44 is the Ip of the web server communicating with the database server. But after adding the line mysql does not restart. Any ideas to fix this? Also, I'd like to know other ways to harden the connection.

share|improve this question
    
Are you trying to limit which remote hosts can connect to your MySQL server? bind-address is not the right way to do that. –  Ladadadada Jun 29 '12 at 11:54
add comment

1 Answer

up vote 3 down vote accepted

Is the web server the same physical server than the database server? bind-address should be an address that is assigned to your server -- if ifconfig lists the address, then you can use it for MySQL. You can't just blindly pick some IP and put that as bind-address, no sir.

EDIT: It seems you understand bind-address completely wrong.

1) Put your database server IP address as bind-address.

2) With MySQL GRANT statements, allow your web server IP (or DNS name...) to access certain database as certain user with the privileges you want to grant, for example

GRANT SELECT,INSERT,UPDATE,DELETE ON mywpinstallation.* 
TO 'someusername'@'yourwebservername.yourdomain.com' 
IDENTIFIED BY 'supersecretpassword'

3) Configure your web application to contact your database server as the user you just granted.

4) Make sure your database server is not reachable from the outside world; use the firewall you have, or if you somehow don't have a separate firewall, just use iptables.

share|improve this answer
    
Janne, the database server is a separate physical server whose IP is 11.22.33.44. So how can I bind it mysql server to webserver's IP? –  alfish Jun 29 '12 at 11:56
    
Domains in MySQL auth can be tricky. Better to stick to IP addresses. The wildcard % is allowed. –  Ladadadada Jun 29 '12 at 12:08
    
@Ladadadada: Sure, the % is allowed but bit too wide open for my taste. With the simple setups domains work OK, but of course if the web server has multiple domains set, things change... –  Janne Pikkarainen Jun 29 '12 at 12:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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