problem Description: After starting MySQL with the root account, MySQL can not be started with MySQL user or other non-root account
problem Solving: By looking at the Err log of MySQL, find Failed to open log (robert-bin.000013, errno),
View error number [[email protected] logs]# perror 13 See OS error code 13:permission denied.
cd/data/mysql/mysql_3306/logs,ll See Binlog and Err Log permissions all become root, execute chown mysql:mysql-r/data/mysql/mysql_3306/
, you can start with the MySQL user.
cause: After starting with Root, the permissions of the Binlog and ErrLog files are changed .
The cases are as follows:
[email protected] logs]# mysqld_safe--user=root &
[1] 6064
[email protected] logs]# 141231 09:38:43 mysqld_safe Logging to '/data/mysql/mysql_3306/logs/robert.err '.
141231 09:38:43 Mysqld_safe starting mysqld daemon with databases From/data/mysql/mysql_3306/data
[email protected] logs]#/etc/init.d/mysqld status
MySQL Running (6412) [OK]
[[email protected] logs] #mysqladmin-uroot-p123456 shutdown
[[email protected] logs]#/etc/init.d/mysqld start//default is MySQL user launcher, Ysqld_safe--user=mysql &
starting MySQL ... The server quit without updating PID file (/data/mysql/mysql_3306/data/robert.localdomain.pid). [FAILED]
[email protected] logs]# tail-f robert.err
141231 08:58:25 Mysqld_safe starting mysqld daemon with databases From/data/mysql/mysql_3306/data
141231 8:58:25 [Note] Plugin ' federated ' is disabled.
141231 8:58:25 innodb:the InnoDB memory heap is disabled
141231 8:58:25 innodb:mutexes and rw_locks use GCC atomic builtins
141231 8:58:25 innodb:compressed tables use zlib 1.2.3
141231 8:58:25 innodb:using Linux native AIO
141231 8:58:25 innodb:initializing buffer pool, size = 128.0M
141231 8:58:25 innodb:completed initialization of buffer pool
141231 8:58:25 innodb:highest supported file format is Barracuda.
141231 8:58:25 innodb:waiting for the background threads to start
141231 8:58:26 innodb:5.5.37 started; log sequence number 396477665
/usr/local/mysql/bin/mysqld:file '/data/mysql/mysql_3306/logs/robert-bin.000013 ' not Found (errcode:13)
141231 8:58:26 [ERROR] Failed to open log (file '/data/mysql/mysql_3306/logs/robert-bin.000013 ', errno)
141231 8:58:26 [ERROR] Could not open log file
141231 8:58:26 [ERROR] Can ' t init TC log
141231 8:58:26 [ERROR] aborting
[email protected] logs]# perror
OS error code 13:permission denied//No access rights
[email protected] logs]#
[email protected] logs]# pwd
/data/mysql/mysql_3306/logs
[email protected] logs]# ll
Total 65812
-rw-rw----1 mysql mysql 126 Dec 10:56 robert-bin.000001
-rw-rw----1 mysql mysql 126 Dec 10:58 robert-bin.000002
-rw-rw----1 mysql mysql 126 Dec 11:11 robert-bin.000003
-rw-rw----1 mysql mysql 1297 Dec 10:05 robert-bin.000004
-rw-rw----1 mysql mysql 12592454 Dec 10:48 robert-bin.000005
-rw-rw----1 mysql mysql 4199546 Dec 12:28 robert-bin.000006
-rw-rw----1 mysql mysql 16792962 Dec 14:01 robert-bin.000007
-rw-rw----1 mysql mysql 558 Dec 14:19 robert-bin.000008
-rw-rw----1 mysql mysql 126 Dec 14:22 robert-bin.000009
-rw-rw----1 mysql mysql 461 Dec 14:09 robert-bin.000010
-RW-RW----1 root root 386 Dec 08:42 robert-bin.000011
-RW-RW----1 root root 126 Dec 08:48 robert-bin.000012
-RW-RW----1 root root 126 Dec 08:50 robert-bin.000013
-rw-rw----1 mysql mysql 598 Dec 08:49 robert-bin.index
-rw-r-----1 mysql root 33101 Dec 08:58 robert.err
-rw-rw----1 mysql mysql 33626181 Dec 08:58 robert.log
-rw-rw----1 mysql mysql 4421 Dec 08:58 robert-slow.log
[email protected] logs]#
[email protected] logs]#
[email protected] logs]# chown mysql:mysql-r/data/mysql/mysql_3306/
[email protected] logs]# ll
Total 65812
-rw-rw----1 mysql mysql 126 Dec 10:56 robert-bin.000001
-rw-rw----1 mysql mysql 126 Dec 10:58 robert-bin.000002
-rw-rw----1 mysql mysql 126 Dec 11:11 robert-bin.000003
-rw-rw----1 mysql mysql 1297 Dec 10:05 robert-bin.000004
-rw-rw----1 mysql mysql 12592454 Dec 10:48 robert-bin.000005
-rw-rw----1 mysql mysql 4199546 Dec 12:28 robert-bin.000006
-rw-rw----1 mysql mysql 16792962 Dec 14:01 robert-bin.000007
-rw-rw----1 mysql mysql 558 Dec 14:19 robert-bin.000008
-rw-rw----1 mysql mysql 126 Dec 14:22 robert-bin.000009
-rw-rw----1 mysql mysql 461 Dec 14:09 robert-bin.000010
-rw-rw----1 mysql mysql 386 Dec 08:42 robert-bin.000011
-rw-rw----1 mysql mysql 126 Dec 08:48 robert-bin.000012
-rw-rw----1 mysql mysql 126 Dec 08:50 robert-bin.000013
-rw-rw----1 mysql mysql 598 Dec 08:49 robert-bin.index
-rw-r-----1 mysql mysql 33101 Dec 08:58 robert.err
-rw-rw----1 mysql mysql 33626181 Dec 08:58 robert.log
-rw-rw----1 mysql mysql 4421 Dec 08:58 robert-slow.log
[email protected] logs]# mysqld_safe--user=mysql &
[1] 6470
[email protected] logs]# 141231 09:40:08 mysqld_safe Logging to '/data/mysql/mysql_3306/logs/robert.err '.
141231 09:40:08 Mysqld_safe starting mysqld daemon with databases From/data/mysql/mysql_3306/data
[email protected] logs]#
[email protected] logs]#/etc/init.d/mysqld status
MySQL Running (6818) [OK]
Note: Starting with the root user does not MySQL, the resulting file permissions are root. Causes other users to be unable to read and write, disable root startup.
MySQL does not start after root user startup no problem