Home > Operation and Maintenance > CentOS > How to install mysql on centos7 system

How to install mysql on centos7 system

王林
Release: 2020-03-16 15:52:30
Original
2681 people have browsed it

How to install mysql on centos7 system

1. Install YUM Repo

1. Since there is no mysql in the yum source of CentOS, you need to download the yum repo configuration file from the official website of mysql.

Download command:

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

(Recommended tutorial: centos usage tutorial)

2. Then install the repo:

rpm -ivh mysql57-community-release-el7-9.noarch.rpm
Copy after login

After the execution is completed, two repo files mysql-community.repo mysql-community-source.repo

will be generated in the /etc/yum.repos.d/ directory. 2. Use the yum command. Complete the installation

Note: You must enter the /etc/yum.repos.d/ directory before executing the following script

1. Installation command:

yum install mysql-server
Copy after login

2. Start msyql:

systemctl start mysqld #启动MySQL
Copy after login
Copy after login

3. Obtain the temporary password during installation (use this password when logging in for the first time):

grep 'temporary password' /var/log/mysqld.log
Copy after login

4. If the temporary password is not obtained, then

4.1. Delete the remaining data of the originally installed mysql

rm -rf /var/lib/mysql
Copy after login

4.2. Restart mysql

systemctl start mysqld #启动MySQL
Copy after login
Copy after login

Related Video tutorial sharing: linux video tutorial

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

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template