在我看来,这种情况的发生仅仅是因为 rackspace 构建(Freebsd 9.1)
root@office:/root # uname -a
FreeBSD office 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4 #1: Fri Jun 21 04:11:23 UTC 2013 root@freebsd:/usr/obj/usr/src/sys/XENHVM amd64
使用新构建的机器,更新端口并从端口编译 mysql-server 后,我尝试启动 mysqld,结果如下:
root@office:/root # cd /usr/
root@office:/root # /usr/local/etc/rc.d/mysql-server start
Starting mysql.
root@office:/root # /usr/local/etc/rc.d/mysql-server status
mysql is not running.
root@office:/root # ps ax | grep mysql
4886 0 S+ 0:00.00 grep mysql
root@office:/root # tail /var/db/mysql/office.err
/usr/local/libexec/mysqld: Can't create/write to file '/tmp/ib1NS09t' (Errcode: 13)
130705 11:35:44 InnoDB: Error: unable to create temporary file; errno: 13
130705 11:35:44 [ERROR] Plugin 'InnoDB' init function returned error.
130705 11:35:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130705 11:35:44 [ERROR] Unknown/unsupported storage engine: InnoDB
130705 11:35:44 [ERROR] Aborting
130705 11:35:44 [Note] /usr/local/libexec/mysqld: Shutdown complete
130705 11:35:44 mysqld_safe mysqld from pid file /var/db/mysql/office.pid ended
在家里做这个,一切都很好。我认为这是由 Rackspace 的某些分区方案引起的。
以下是有关权限和分区的一些信息:
root@office:/root # df -h
Filesystem Size Used Avail Capacity Mounted on
zroot 15G 958M 15G 6% /
devfs 1.0k 1.0k 0B 100% /dev
zroot/tmp 15G 192k 15G 0% /tmp
zroot/usr 16G 1.3G 15G 8% /usr
zroot/usr/ports 16G 1.5G 15G 9% /usr/ports
zroot/usr/ports/distfiles 15G 145M 15G 1% /usr/ports/distfiles
zroot/usr/ports/packages 15G 144k 15G 0% /usr/ports/packages
zroot/usr/src 15G 509M 15G 3% /usr/src
zroot/var 15G 1.1M 15G 0% /var
zroot/var/crash 15G 148k 15G 0% /var/crash
zroot/var/db 15G 306M 15G 2% /var/db
zroot/var/db/pkg 15G 2.2M 15G 0% /var/db/pkg
zroot/var/empty 15G 144k 15G 0% /var/empty
zroot/var/log 15G 256k 15G 0% /var/log
zroot/var/mail 15G 148k 15G 0% /var/mail
zroot/var/run 15G 244k 15G 0% /var/run
zroot/var/tmp 15G 152k 15G 0% /var/tmp
root@office:/root # ls -lah /tmp
total 60
drwxr-xr-x 7 root wheel 7B Jul 5 03:05 .
drwxr-xr-x 18 root wheel 24B Jun 20 20:33 ..
drwxrwxrwt 2 root wheel 2B Jul 4 12:39 .ICE-unix
drwxrwxrwt 2 root wheel 2B Jul 4 12:39 .X11-unix
drwxrwxrwt 2 root wheel 2B Jul 4 12:39 .XIM-unix
drwxrwxrwt 2 root wheel 2B Jul 4 12:39 .font-unix
drwx------ 2 root wheel 3B Jul 4 13:07 tmux-0
问题是:如何发现问题并解决它?
最好不要设置tmpdir
参数my.cnf
,我想以适当的方式修复此问题,以便我可以向 rackspace 反馈他们在构建中犯了一些错误。
答案1
root@office:/root # ls -lah /tmp
total 60
drwxr-xr-x 7 root wheel 7B Jul 5 03:05 .
drwxr-xr-x 18 root wheel 24B Jun 20 20:33 ..
具有此类权限,只有 root 才具有对 /tmp 的写入权限。您可以尝试更改它
# chmod 777 /tmp
答案2
我也为此苦恼,并通过更改文件的默认位置解决了这个问题my.cnf
[client]
port = 3306
# socket = /tmp/mysql.sock
socket = /var/db/mysql/mysql.sock
[mysqld]
...
# socket = /tmp/mysql.sock
socket = /var/db/mysql/mysql.sock
...