First enter the root super user
Because mariadb data is installed by default in centos7
Therefore, you must first find out the installed database version and uninstall the database side by side.
rpm -qa | grep mariadb
yum remove mariadb-XXX
delete all displayed
To install mysql, you need to download three packages,
wget http://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-server-5.6.29-1.el7.x86_64.rpm
wget http://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-devel-5.6.29-1.el7.x86_64.rpm
wget http://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-client-5.6.29-1.el7.x86_64.rpm
Install after download is complete
yum install MySQL-5.6/MySQL-server-5.6.29-1.el7.x86_64.rpm
yum install MySQL-devel-5.6.29-1.el7.x86_64.rpm
yum install MySQL-client-5.6.29-1.el7.x86_64.rpm
Install in order
entering the database
mysql -uroot
Once logged in, you can set your username and password
set password = password(123456');
exit(); exit
Put the 3306 port number in the port
.open port
firewall-cmd --zone=public --add-port=3306/tcp --permanent
Command meaning:
--zone #scope
--add-port=21/tcp #Add port, the format is: port/communication protocol
--permanent #Permanent effect, invalid after restart without this parameter
restart firewall
firewall-cmd --reload
all open ports
firewall-cmd --list-all--zones