Home >Database >Mysql Tutorial >An introduction to how to use YUM to quickly install MySQL5.7 under Centos7.2
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_64Download the YUM library
# rpm wgethttp://dev.MySQL.com/get/mysql57-community-release-el7-7.noarch.rpmInstall the YUM library
# rpm yum localinstall -ymysql57-community-release-el7-7.noarch.rpmInstall the database
# rpm yum install -y mysql-community-serverStart the MySQL service
# rpm systemctl start mysqld.serviceDue 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 -pReset the root user password
mysql > alter user 'root'@'localhost' identified by '密码';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;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;Open port 3306
# firewall-cmd --add-port=3306/tcp
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!