📌  相关文章
📜  安装 mysql 8 ubuntu 18.04 - SQL (1)

📅  最后修改于: 2023-12-03 14:53:32.059000             🧑  作者: Mango

安装 MySQL 8 on Ubuntu 18.04

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.

Step 1: Update System

First, let's make sure our system is up-to-date.

sudo apt update
sudo apt upgrade
Step 2: Install MySQL

We will install MySQL server and client packages using the apt package manager.

sudo apt install mysql-server mysql-client
Step 3: Secure MySQL

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.

Step 4: Start MySQL

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
Step 5: Test 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.

Conclusion

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.