📅  最后修改于: 2023-12-03 14:53:32.059000             🧑  作者: Mango
MySQL is one of the most popular open source relational database management system. In this tutorial, we will learn how to install MySQL 8 on Ubuntu 18.04.
First, let's make sure our system is up-to-date.
sudo apt update
sudo apt upgrade
We will install MySQL server and client packages using the apt package manager.
sudo apt install mysql-server mysql-client
It is recommended to secure MySQL installation by running the mysql_secure_installation
command.
sudo mysql_secure_installation
This command will ask you some security-related questions such as setting the root password, removing anonymous users, disabling remote root login, and removing test databases. Once you have completed the setup, you will have a secure MySQL installation.
Start the MySQL service using the following command:
sudo systemctl start mysql
You can verify that the MySQL service is running using the following command:
sudo systemctl status mysql
To test MySQL installation, log in to MySQL server using the root account.
sudo mysql -u root -p
It will ask you for the root user password which you have set during mysql_secure_installation
.
Once you have successfully logged in, you will be at the MySQL prompt where you can start executing SQL queries.
In this tutorial, we have learned how to install MySQL 8 on Ubuntu 18.04, secure the installation and test it. Now you can go ahead and start working with MySQL.