How to install mysql database on google cloud VM instance

What you will learn here about mysql database installation on Google Cloud VM instance

  • How to install mysql database on google cloud VM instance

In order to install mysql database on google cloud VM instance first you need a VM instance. If you do not know how to create a VM instance on Google Cloud please visit the following link.

Creating VM instance on Google Cloud

How to install mysql database on google cloud VM instance

Please follow the following steps to know h1
1)Assuming you have created VM instance successfully.

2)Now please click on SSH of respective VM instance on which you want to install MYSQL database which is shown below
install mysql on google cloud

3)Please execute following command to go in root mode which is shown below

sudo su
cd ../..

4)Execute the following command to update the existing packages.

sudo apt-get update

5)Now execute the following to install MySQL server which is shown below. While installing if it is asking do you want to continue then please enter y and hit enter

sudo apt-get install mysql-server

How to install mysql database on google cloud VM instance

6)Now please execute the following command for secure installation which is shown below.

sudo mysql_secure_installation

7)Please hit Enter for current root password.

8)Now please Enter y and hit Enter for setting a new password which is shown below

9)Now Please enter New password which is shown below

10)Now please enter y to remove anonymous user and hit Enter.

11)Now please enter y to disallow remote login which is shown below

12)Please enter y to remove test databases which is shown below

13)Please enter y to reload privileges tables which is shown below

14)Now please execute the following command to login into the database and Enter the password which you have entered in step 9.

sudo mysql -u root -p


15)Please execute the following command to see databases present in the mysql database.

show databases;


16)Execute the following to create Demo database in mysql server which is shown below.

CREATE DATABASE Demo;


17)Now please execute the following to go in Demo database

USE Demo;

If you are getting any error for following command then please replace all single quote with the single quote of your keyboard

18)Please execute the following command to create database user

CREATE USER ‘admin’@’localhost’ IDENTIFIED BY ‘admin’;


19)Execute the following command to grant all privileges

GRANT ALL PRIVILEGES ON Demo.* TO ‘admin’@’localhost’;


20)Now execute the following command save all the changes

FLUSH PRIVILEGES;


21)Now please execute the following command to come out of database.

quit


22)Execute the following command to restart the MYSQL server

sudo service mysql restart

You may also like...

Leave a Reply