Hello, this post will help you install MySQL Server version 8 on Ubuntu 18.04, Ubuntu 19.04.
By the way, Ubuntu 19.10. Ubuntu 19.10 is my favorite of all time. If you have not installed Ubuntu 19.10 yet. Go ahead and upgrade your Ubuntu. You would not regret; I promise.
For this demonstration, I will be using Ubuntu 19.10, for sure.
Go ahead and launch your terminal and update the system with the following commnad.
sudo apt update && sudo apt upgrade
Install MySQL 8 Client & Server
Clear your terminal and type the following command to install mysql 8 client and server.
sudo apt install mysql-server -y
Wait for a minute or two and you are done.
Now, we need to alter mysql root password. First login with sudo user to MySQL server. just type the following commands.
sudo mysql
Type your Ubuntu sudo password and hit enter.
Now, let’s change/assign the new password to the MySQL root user.
You are advised to choose a strong password, I have typed xxxxx
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'XXXXX';
Now, flush privileges with the following command
FLUSH PRIVILEGES;
Update
If you are getting error shown below then try mysql_secure_installation command.
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
If above method deos not work, you should try running command below to create root password for mysql -u root
mysql_secure_installation
You have successfully installed MySQL 8 on your Ubuntu now.
Let’s exit and log back in to MySQL server with new root password
exit
mysql -u root -p
Type in your new password and you are in..
Here are few MySQL commands that can help you get started with
CREATE DATABASE dbname;
SHOW DATABASES;
Join MySQL Bootcamp
If you want to master MySQL and land a job; consider joining this at a very affordable price.
For more you can watch my MySQL database video tutorial