Search code examples
mysqllinuxcentosiptablesmysql-workbench

Accessing a mysql database from external host/ip? (ie: mysql workbench)


I have a mysql server running on x.x.x.x, and can access it internally no problem (of course). However when attempting to connect externally, ie using mysql workbench, or even from an external server, I get the error message "Host 'bla.bla.bla' is not allowed to connect to this MySQL server".

I have done:

  • GRANT ALL PRIVILEGES ON *.* TO mysql@x.x.x.x IDENTIFIED BY "somepass";
  • And I have opened port 3306 in iptables.

Is there another fundamental security issue I am missing?


Solution

  • You need to do

    GRANT ALL PRIVILEGES ON *.* TO mysql@'bla.bla.bla' ...
    

    The part after the @ is the host from which the connection is coming, so you have allowed only connections coming from localhost. You need to allow access from each remote host necessary (or all hosts - ... mysql@'%' ... - if applicable).