Home >Operation and Maintenance >CentOS >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
(Recommended tutorial: centos usage tutorial)
2. Then install the repo:
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
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
2. Start msyql:
systemctl start mysqld #启动MySQL
3. Obtain the temporary password during installation (use this password when logging in for the first time):
grep 'temporary password' /var/log/mysqld.log
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
4.2. Restart mysql
systemctl start mysqld #启动MySQL
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!