Freebsd

mysql沒有執行

  • July 30, 2018

在我看來,這只是因為機架空間建構(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

在家裡做這個,一切正常。我認為這是由某些分區方案引起的,機架空間確實如此。

這裡有一些關於燙髮和分區的資訊:

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 回饋他們在建構中犯了一些錯誤。

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

我也扼殺了它並通過更改文件上的預設位置來解決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
...

引用自:https://serverfault.com/questions/521065