Home > Database > Mysql Tutorial > body text

An introduction to how to use YUM to quickly install MySQL5.7 under Centos7.2

黄舟
Release: 2017-06-18 10:41:57
Original
1172 people have browsed it

This article mainly introduces how to quickly install MySQL5.7 using YUM under Centos7.2. Friends who need it can refer to it

Uninstall the mariadb database that comes with the system


##

# rpm -qa| grep mariadb
# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64
Copy after login

Download the YUM library


# rpm wgethttp://dev.MySQL.com/get/mysql57-community-release-el7-7.noarch.rpm
Copy after login

Install the YUM library


# rpm yum localinstall -ymysql57-community-release-el7-7.noarch.rpm
Copy after login

Install the database


# rpm yum install -y mysql-community-server
Copy after login

Start the MySQL service


# rpm systemctl start mysqld.service
Copy after login

Due to mysql5.7 will automatically generate a password, and the password file is stored in /var/log/mysqld.log

Search for the password keyword to find the password, log in to mysql


# mysql -uroot -p
Copy after login

Reset the root user password


mysql > alter user 'root'@'localhost' identified by '密码';
Copy after login

Just log in again as the root user and the password you just set. And authorize user root to connect to mysql server from any host using password


mysql > grant all privileges on *.* to 'root'@'%' identifiedby '密码' with grant option;
mysql > flush privileges;
Copy after login

or allow user root to connect to mysql server only from the host with ip 192.168.1.1


mysql > grant all privileges on *.* to 'root'@'192.168.1.1' identified by '密码' with grant option;
mysql > flush privileges;
Copy after login

Open port 3306


# firewall-cmd --add-port=3306/tcp
Copy after login

The above is the detailed content of An introduction to how to use YUM to quickly install MySQL5.7 under Centos7.2. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!