centos yum install mysql

WBOY
Release: 2023-05-20 11:27:07
Original
570 people have browsed it

In CentOS systems, Yum is a powerful package manager that can be used to easily install and upgrade various software. Mysql is one of the most popular relational databases. This article will introduce how to use yum to install Mysql.

  1. Install Yum

If Yum is not installed on your CentOS system, please use the following command to install it:

sudo yum install yum
Copy after login
  1. Add Mysql Yum source

There is no Mysql package in the CentOS official repository, so you need to add the Mysql Yum source for installation. Mysql officially provides a configuration file for the Yum source, so you only need to add it to the system.

Use the following command to download the configuration file of the Mysql Yum source:

sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Copy after login

Install the configuration file:

sudo rpm -ivh mysql57-community-release-el7-10.noarch.rpm
Copy after login
  1. Install Mysql

Installation Mysql software package:

sudo yum install mysql-server
Copy after login

During the installation, the system may prompt you whether you want to install dependent packages. Enteryand press Enter.

  1. Start Mysql

After the installation is completed, we need to start the Mysql service:

sudo systemctl start mysqld.service
Copy after login

Auto-start at boot:

sudo systemctl enable mysqld.service
Copy after login
  1. Configuring Mysql

After starting Mysql, you need to perform some basic configuration, such as setting the password of the Mysql root user.

Use the following command for initial configuration:

sudo mysql_secure_installation
Copy after login

At this time, the system will prompt you to enter the password of the Mysql root user. If this is the first installation, the password is blank by default, just press the Enter key. After that, you will be prompted whether you want to change the password of the Mysql root user. If you want to change the password, please follow the system prompts.

Next, the system will prompt you whether you want to prohibit the Mysql root user from using remote login. For security reasons, it is recommended that you disable remote login to prevent hacker attacks.

The system will also prompt you whether you want to automatically delete anonymous users and test databases. These users and databases are usually unnecessary and it is recommended that you delete them.

  1. Test Mysql

After installing and configuring Mysql, you can use the following command to connect to Mysql:

sudo mysql -u root -p
Copy after login

Enter the password of the Mysql root user, that is Can log in to Mysql. At this point, you can start operating and managing the Mysql database.

  1. Summary

Through the introduction of this article, you already know how to use yum to install Mysql, as well as some basic configuration and operations. Mysql is a very practical database tool, and mastering this knowledge will help you better manage and process data.

The above is the detailed content of centos yum install mysql. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!