Home  >  Article  >  Computer Tutorials  >  CentOS7 installs MySQL8

CentOS7 installs MySQL8

PHPz
PHPzforward
2024-02-19 20:36:551283browse

CentOS7 installs MySQL8

MySQL is a commonly used open source relational database management system that is widely used in web application development. Installing MySQL 8 on CentOS 7 can support server-side data storage and management to meet the needs of applications. This tutorial will guide you to install MySQL 8 on CentOS 7 system.

Step 1: Add MySQL Yum source

MySQL provides Yum Repository, making it very easy to install MySQL on CentOS 7 systems. Use the following command to add MySQL Yum Repository.

sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Step 2: Install MySQL 8

Before installing MySQL 8, use the following command to update the system package.

sudo yum update

Then use the following command to install MySQL 8.

sudo yum install mysql-community-server

After the installation is complete, use the following command to start the MySQL service.

sudo systemctl start mysqld

Use the following command to set MySQL to start automatically when the system starts.

sudo systemctl enable mysqld

Step 3: Security Settings

After installing MySQL, security settings need to be performed. Use the following command to execute the MySQL security script.

sudo mysql_secure_installation

This script will prompt you to set the password of the MySQL root user, delete anonymous users and test databases, and prohibit the root user from logging into MySQL through remote connections.

Step 4: Log in to MySQL

After installation and security settings, you can use the following command to log in to MySQL.

mysql -u root -p

Among them, the -u option indicates the user to be used, and the -p option indicates that a password needs to be entered for verification. If the password is correct, the MySQL shell will open, allowing you to perform various operations in MySQL.

The above is the detailed content of CentOS7 installs MySQL8. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete