Want to develop web-based software applications and websites? MySQL is your go-to option. It is one of the most popularly used open-source relational database management systems. It is a quick, easy, and scalable SQL-based system that is a crucial part of the LAMP stack that consists of Linux, Apache, MySQL, and PHP, which powers much of the Internet. This article will guide you on how to install MySQL on Ubuntu.
Table of Contents
How to install MySQL on Ubuntu
To have a working relational database for creating your websites and applications, you can install MySQL Version 8.0 on an Ubuntu 20.04 server. The steps are given below.
To install MySQL, use the terminal prompt to execute the following command:
sudo apt update
Enter your password, then wait while the update is complete. Run the subsequent command next:
sudo apt upgrade
When asked to proceed with the upgrade, enter Y and click ENTER. After updating the package repository, you can proceed with installing MySQL.
Enter the subsequent command to set up MySQL Server.
sudo apt install mysql-server
If the system prompts you to continue the installation, select Y and press ENTER. The result should seem as follows:
The MySQL Packages will then be downloaded by the system and installed on the computer of your choice.
Run the following command to check whether MySQL was correctly set up.
The version of MySQL installed on the machine is displayed in the output.
Configuring the MySQL installation
After installation, your machine’s MySQL instance is already unsafe.
To protect your MySQL user account with password authentication, run the security script that has been provided:
When prompted to continue configuring the VALIDATE PASSWORD component, enter your password and select Y. The component determines whether the new password is sufficiently secure. Passwords must be at least eight characters long and have a combination of uppercase, lowercase, numeric, and special characters to qualify for the strictest policy level, which you can select by entering 2. The software then requests a confirmation password input from you twice. The password strength you choose for future MySQL users must match it.
Press Y if the password meets your requirements. Choose another key if necessary.
The script then requests the following security features:
- Take away the anonymous users?
- Disallow remote root logins?
- Take away access to the test database, and it?
- Now reload the privilege tables.
Y is the suggested response to each of these queries. If you’d like a different option, enter any other key.
For instance, press any key other than Y at the prompt if you require the server’s remote login option.
Make that the MySQL service is up and functioning.
Once MySQL has been successfully installed, the MySQL service starts up immediately.
Check to see if the MySQL service is running.run:
sudo systemctl status mysql
The result should confirm that the service is active and running:
Logging into the MySQL server
Use the following command to log in to the MySQL interface:
sudo mysql -u root
You may now use your new MySQL configuration to run queries, build databases, and test them. Check out our MySQL Commands Cheat Sheet to learn some crucial MySQL commands.
See also: Install conda on ubuntu