After installing and initializing MySQL database under Linux, use mysqld_ Safe starts the MySQL database, as shown below, the startup fails
[ root@SVNServer bin]# ./mysqld_ safe –user=mysql&
Or
[ root@SVNServer bin]#/etc/init.d/mysqld start
Starting MySQL. ERROR! The server quit without updating PID file (/data/mysql/AY14020816093477605eZ.pid).
Restart MySQL will throw the above red font error
You can only see the specific reasons for the failure of starting mysql. You need to check the. Err file in the database directory and the. Err file. The contents are as follows:
140726 00:18:10 mysqld_ safe mysqld from pid file /data/mysql/AY14020816093477605eZ.pid ended
140726 00:31:19 mysqld_ safe Starting mysqld daemon with databases from /data/mysql
/usr/local/mysql/bin/mysqld: File ‘./mysql-bin.index’ not found (Errcode: 13)
140726 0:31:19 [ERROR] Aborting
140726 0:31:19 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
This error report is marked in red, errcode13, which is generally a permission problem. Whether MySQL users have permission to write all the files in the database directory, check the permissions, and modify the permissions of users and user groups in the MySQL directory
chown -R mysql:mysql /usr/local/mysql
Check the permissions in the/usr/local/MySQL directory, as shown in the following figure
I found the problem. It’s really a permission problem. The following troubleshooting is simple. Assign the owner of the data directory to the MySQL user
in RedHat system, : chown mysql.mysql – R/usr/local/MySQL can be used
in CentOS system, : chown can be used mysql:mysql -R /usr/local/mysql
OK, now start MySQL again, as shown in the figure below, there is no error
[ root@SVNServer bin]#/etc/init.d/mysqld start
If the error is still reported, it may be the permission setting problem of/usr/local/MySQL directory. The permission setting is as follows:
chmod 755 /usr/local/mysql
After setting, the permissions are as follows: ll/usr/local/MySQL
Drwxr-xr-x 9 MySQL MySQL 12288 July 26 09:50 MySQL
Try, can connect, as shown in the figure, OK