Wednesday, June 23, 2021

Install MySQL on Ubuntu 18.04

 Install mysql database on the Ubuntu OS.

1. open terminal

 execute below command

sudo apt-get update
2. sudo apt-get install mysql-server

3.sudo systemctl status mysql - check status of mysql db

4.sudo mysql_secure_installation
It's asking for Root new password
5.For all the other asking questions  enter 'y'
 

 
6.Next enter mysql -u root -p
Then it's ask for password
After that It's giving below error message.
7.
 Then enter sudo mysql command


8. After that enter below sql query

SELECT user,authentication_string,plugin,host FROM mysql.user;

you can see output as follows


then I change Root password as follows.

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '257F257f';



9.then press below sql query.

FLUSH PRIVILEGES;

10. next see below sql query.

SELECT user,authentication_string,plugin,host FROM mysql.user;


Now output will be as follows.

You can see in this example output that the root MySQL user now authenticates using a password. Once you confirm this on your own server,
you can exit from mysql shell using exit command.
Next login to my sql you have to do following command
 
mysql -u root -p
 



No comments: