Yuminstallmysql indicates that mysql installation is complete, but servicemysqlstatus and servicemysqlstart both indicate failure and the database cannot be logged in. [Root @ ansibleflask_sqlalchemy] # servicemysqlstatusRedirectingto/bin/systemctlstatusm
Yum install mysql indicates that mysql installation is complete, but service mysql status and service mysql start indicate failure, and the database cannot be logged in.
[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. 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
You can log on to the database, but service mysql still prompts the above error. further analysis is required.