External access to MySQL database

To gain external access to MySQL database (f.e. in PHPSTorm or an external PHPMyAdmin) you can do:

  1. GRANT necessary privileges:

    If the user already exists, you can leave the first line.
  2. Allow access from outside localhost:

    On CentOS the my.cnf usually is directly located in /etc/ and the service name is mysqld.

Check if configuration for external access to MySQL database was successful

You can get the privileges of the currently connected MySQL user by connection to the database server on shell an running:

This should show you something like that:

If you want to see which permissions a certain user has from localhost:

And to check external access to MySQL database:

As you can see, if you let out the host portion, you will get the privileges for ‘%’, which means every host.

One thought on “External access to MySQL database

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.