Wednesday, 21 February 2018


Mysql database creation for Remotely accessing database


In this tutorial we are going to see how to create mysql database for local use and how to configure it for remotely accessing the database.

For this tutorial I have taken AWS-EC2 Instance and configured the security group to allow the inbound connection for mysql database from remote IP.

You can add the particular IP or allow everyone to connect to it. But for the security reason you should allow only specific IP from where you want to access database.

I have taken Ubuntu EC2 instance for this demo. You can take of your choice.

1. First of all update and upgrade your Instance like below :- 

sudo apt-get update
sudo apt-get upgrade

2. Install the mysql-server on your instance :-

sudo apt-get install mysql-server -y

3. Configure the mysqld.cnf like below :-

Change the bind address from to like below 

cd /etc/mysql/mysql.conf.d/
vim mysqld.cnf

bind-address =

save and exit the file 

4. Restart the mysql service to take effect :-

sudo service mysql restart

5. Create the database for remotely accessing the database :-

The only difference is you will have to keep in mind that you have to assign remote location ip from where you will access the database. 

CREATE USER 'testing1'@'' IDENTIFIED BY 'testing1';
GRANT ALL PRIVILEGES ON testing1.* TO 'testing1'@'';

For locally accessing the database you can define localhost instead of IP address. 

To allow anyone create database like below :-

CREATE USER 'wordpress'@'%' IDENTIFIED BY 'wordpress';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'%';

Here % mean anyone can connect to database.

That's it guys
Please do Comments, Likes and Share.   

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

Follow by Email