Workaround:
1. Check if MySQL permissions are a problem (default installation is yum-y install MySQL)
Go to the/etc/rc.d/init.d/directory
[Email protected] init.d]# mysqld status
2018-06-11 15:20:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is Depreca ted. Please use the--EXPLICIT_DEFAULTS_FOR_TIMESTAMP server option (see Documentati in for more details).
2018-06-11 15:20:47 0 [Note] mysqld (mysqld 5.6.40) starting as Process 12917.. .
2018-06-11 15:20:47 12917 [ERROR] Fatal error:please read "Security" section of the manual-find out how to run mysqld As root!
2018-06-11 15:20:47 12917 [ERROR] Aborting
2018-06-11 15:20:47 12917 [Note] Binlog End
2018-06-11 15:20:47 12917 [Note] Mysqld:shutdown complete
The first of these errors is
2018-06-11 15:20:47 12917 [ERROR] Fatal error:please read "Security" section of the manual-find out how to run mysqld As root!
This is because MySQL, for security purposes, does not want the root user to start MySQL directly.
So you can add user=mysql to the/etc/my.cnf to specify the MySQL user
--------------------------------------------------------------------
[Mysqld]
User=mysql
--------------------------------------------------------------------
[[email protected] search]# MySQL
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3
Server version:5.6.40 MySQL Community Server (GPL)
Copyright (c), 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
You can see that MySQL started successfully.
Reported: Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2) error.