MySQL by default allows you to connect to it via localhost, you can not connect and make changes to it by directly connecting from some remote IP address. But it is a very common task, you often need to enable remote mysql access in order to access mysql server remotely.
Enabling remote mysql access is very simple, we just need to perform a little editing in the mysql configuration file. Open the /etc/mysql/my.cnf file by running the following command:
Now change the bind- address entry to your IP address.
Once done with the change, enter into mysql from localhost and run the following command:
grant all on *.* to adminm@’%’ identified by ‘123456’
The above command needs some explanation, *.* means that you will be able to access all databases remotely, admin means that you will be able to access mysql via the admin user, and identified by ‘123456’ means that the admin user will use 123456 as a password to authenticate.