Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

how have I to add a trusted hostname in the mysql configuration?

I would like to add the in the mysql database installed in the

so all the connections that come from the must be accepted.


share|improve this question

1 Answer 1

I am not sure what you are trying to achieve here nor whether mysql has a concept of trusted hosts. But if you are doing this for security reasons, then do it at the user level when adding users in mysql. In other words, you will have to setup a user in mysql which connects from the webserver only, you can do this through the grant privileges options -

mysql> grant all privileges on *.* to identified by 'password';
mysql> flush privileges;

On top of that, modify your firewall rules to allow mysql connections, port 3306, from - In iptables you can do it this way:

/sbin/iptables -I INPUT -s webserver-ip-address -p tcp --dport 3306 -j ACCEPT
share|improve this answer
Setting up users like this is great as long as you do not configure my.cnf with skip-host-cache or skip-name-resolve. +1 !!! – RolandoMySQLDBA Mar 8 '13 at 22:00
I agree. Thanks for the clarification. – Daniel t. Mar 8 '13 at 22:04
Hi @Danielt. thanks for your reply. So is not possible set just a record in order to trust of the webserver hostname for all the requests? – Michelangelo Mar 9 '13 at 7:38
@Michelangelo - Not that I am aware of. Don't take my word for it though, as I am not a DB administrator. And yet, I don't see the point of adding a trusted host, as you have to use a username/pass to access a database and to accomplish that you have to add the users in mysql. It is during this process that you specify the host from which the user is allowed to login. – Daniel t. Mar 9 '13 at 21:19

Your Answer


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.