How to fix error MySQL mariaDB on Centos

Display yum install MySQL MySQL installation is complete, the service MySQL status, service MySQL start prompted failed, the database is also unable to login.

[root@ansible flask_sqlalchemy]# service mysql status
Redirecting to /bin/systemctl status mysql.service
● mysql.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
[root@ansible flask_sqlalchemy]# service mysql start
Redirecting to /bin/systemctl start mysql.service
Failed to start mysql.service: Unit mysql.service failed to load: No such file or directory.

[root@ansible flask_sqlalchemy]# mysql -u root
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

Solution:

# yum install mariadb-server -y

# systemctl start mariadb.service

# systemctl enable mariadb.service

# mysql

Reference: http://www.centoscn.com/CentosBug/softbug/2016/0115/6660.html

Can log on to the database, but the service MySQL still prompts this error because further analysis was required.