Set root password for mysql on Ubuntu LTS 16.04.3

After a manual installation of mysql using apt-get install (instead of install it during ubuntu installation), to set the root password for mysql on Ubuntu LTS 16.04.3, follow the steps below:

sudo mysql 

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'hard to guess password'; 
Query OK, 0 rows affected (0.01 sec) 

mysql> flush privileges; 
Query OK, 0 rows affected (0.01 sec) 

mysql> exit 
Bye

Please replace ‘hard to guess password’ with your own password.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s