查看mysql日志时出现以下报错
vi /home/mysql/var/localhost.localdomain.err
160426 3:07:23 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete
160426 03:07:23 mysqld_safe mysqld from pid file /home/mysql/var/localhost.localdomain.pid ended
160426 03:17:25 mysqld_safe Starting mysqld daemon with databases from /home/mysql/var
160426 3:17:26 [Note] Plugin ‘FEDERATED‘ is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
^G/usr/local/mysql/libexec/mysqld: Can‘t create/write to file ‘/tmp/ib1yAlZB‘ (Errcode: 13)
160426 3:17:26 InnoDB: Error: unable to create temporary file; errno: 13
160426 3:17:26 [ERROR] Plugin ‘InnoDB‘ init function returned error.
160426 3:17:26 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.
160426 3:17:26 [ERROR] Can‘t start server : Bind on unix socket: Permission denied
160426 3:17:26 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
160426 3:17:26 [ERROR] Aborting
Can’t create/write to file ‘/tmp/’ (Errcode: 13)
So, let’s see what an error 13 really means:
perror 13
And we see it’s a permission denied error:
[[email protected] ~]$ perror 13 OS error code 13: Permission denied
The solution?
Set the correct owner and permissions to /tmp by running this
commands:
chown root.root /tmp -v chmod 1777 /tmp -v
Now restart MySQL to test it:
/etc/init.d/mysqld start
That’s all, now your MySQL server should be able to start without any
warnings or failures:
[[email protected]:~]service mysqld start Starting mysqld: [ OK ]