Install a MySQL Database Server On Ubuntu
If you’re using WordPress, you’ll need a MySQL database to store all of the content associated with your posts and pages. And you’ll need a MySQL server to serve that database.
Fortunately, setting up a MySQL database server is super simple.
Install A MySQL Database Server
ssh -i ~/.ssh/supernifty firstname.lastname@example.org RETURN
While the video doesn’t show this step, it’s a good idea to run this command before installing any new software just to make sure you’ve got the latest version information for the most up-to-date packages available:
sudo apt update RETURN
Install the MySQL server software:
sudo apt install mysql-server RETURN
Once the software is installed, it’s a good idea to secure the MySQL server installation:
sudo mysql_secure_installation RETURN
This process will walk you through a series of questions you’ll need to answer.
VALIDATE PASSWORD COMPONENT? Y RETURN
Do you want to force users of your MySQL database to create strong passwords? If you’re working with a standard WordPress installation, you’re only going to have one password that will need to stand up to this challenge, but it’s not a bad idea to force that one password to be strong.
CHOOSE LOW, MEDIUM OR STRONG PASSWORD VALIDATION: STRONG RETURN
CREATE THE MYSQL ROOT USER PASSWORD: (Enter password) RETURN
It helps to have a super-strong password handy.
REMOVE ANONYMOUS USERS? Y RETURN
DISALLOW REMOTE ROOT LOGIN? Y RETURN
REMOVE TEST DATABASE AND ACCESS TO IT? Y RETURN
RELOAD PRIVILEGES? Y RETURN
Whenever you make changes to anyone’s access to a MySQL database, you need to reload privileges before those changes will take effect.
Once the MySQL server is up and running, you’re ready to create a new MySQL database and user on it.