First of all centos7 does not support mysql, because you know how to charge,So mariadb is integrated internally, and if you install mysql, it will conflict with mariadb files.So you need to uninstall mariadb first, here are the steps to uninstall mariadb and install mysql.

#List all installed rpm packages

rpm -qa | grep mariadb


rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64

Error:Dependency detection failed:

libmysqlclient.so.18 () (64bit) is required by (installed) postfix-2:2.10.1-6.el7.x86_64

libmysqlclient.so.18 (libmysqlclient_18) (64bit) is required by (installed) postfix-2:2.10.1-6.el7.x86_64

#Forced uninstall,Because there is no --nodeps

rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64

#Install mysql dependency

yum install vim libaio net-tools

#Install the rpm package of mysql5.5.39

rpm -ivh /home/liwei/mysql-server-5.5.39-2.el6.x86_64.rpm

rpm -ivh /home/liwei/mysql-client-5.5.39-2.el6.x86_64.rpm

#Copy the configuration file

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf, renamed my.cnf as the mysql configuration file

#Modify the configuration file of the response

vim /etc/my.cnf

#Copy mysql data to the specified directory

mv/var/lib/mysql/home/mysql/data /

Also note the owner and permissions of the directory.

After mysql startup:error! the server quit without updating pid file error

mysql log:can "t find file:" ./mysql/plugin.frm "(errno:13-permission denied)

1. Insufficient permissions:chown -r mysql:mysql/home/mysql/data "" chmod -r 755/home/mysql/data

2. Selinux problem with centos7:Open/etc/selinux/config, change selinux=enforcing to selinux=disabled, save the disk and exit to restart the machine.

Let's take a look at the additions of other netizens:

1. There is no direct installation package of mysql-server for yum under centos;

mariadb is a branch of the mysql community development,Is also an enhanced alternative;

2.Install mariadb

yum -y install mariadb-server mariadb mariadb-devel

systemctl start mariadb

systemctl enable mariadb


firewall-cmd --permanent --add-service mysql

systemctl restart firewalld.service

iptables -l -n | grep 3306

3.Log in to the database to see if it has improved.

msyql -uroot -p

show databases;

  • Previous mysql ERROR 1044 (42000): Access denied for user `` @ 'localhost' to database
  • Next ASP replacement, save remote image implementation code