CentOS7 installs MySQL8

PHPz
Release: 2024-02-19 20:36:55
forward
1290 people have browsed it

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
Copy after login

Step 2: Install MySQL 8

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

sudo yum update
Copy after login

Then use the following command to install MySQL 8.

sudo yum install mysql-community-server
Copy after login

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

sudo systemctl start mysqld
Copy after login

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

sudo systemctl enable mysqld
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:mryunwei.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template