
介紹
我在我的 Linux 機器上運行 MariaDB 和 Apache,今天遇到了一些問題。
我透過 SSH 連接到伺服器,以下是我面臨的一些問題。我完全不知道我在這裡做什麼。
我在做什麼
步驟1:mysql -u USERNAME -p
錯誤2002(HY000):無法透過套接字'/var/run/mysqld/mysqld.sock'連接到本機MySQL伺服器(2「沒有這樣的檔案或目錄」)
好吧,所以我想,讓我們試著停止 mysql 服務
第2步:sudo service mysql stop
好的,沒有錯誤,重啟服務
步驟3:sudo service mysql restart
mysql.service 作業失敗。有關詳細信息,請參閱“systemctl status mysql.service”和“journalctl -xe”。
好的,我最好運行這兩個命令並查看我得到的結果
步驟4:status mysql.service
嗯..好吧,讓我們試試另一個
第5步:journalctl -xe
未找到日誌檔。
好吧,我在這裡迷路了..
MySQL錯誤日誌
150824 14:42:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150824 14:42:58 [Note] /usr/sbin/mysqld (mysqld 10.0.20-MariaDB-0ubuntu0.15.04.1) starting as process 22637 ...
150824 14:42:58 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
150824 14:42:58 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
150824 14:42:58 [ERROR] Plugin 'Aria' init function returned error.
150824 14:42:58 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
150824 14:42:58 [Note] InnoDB: Using mutexes to ref count buffer pool pages
150824 14:42:58 [Note] InnoDB: The InnoDB memory heap is disabled
150824 14:42:58 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
150824 14:42:58 [Note] InnoDB: Memory barrier is not used
150824 14:42:58 [Note] InnoDB: Compressed tables use zlib 1.2.8
150824 14:42:58 [Note] InnoDB: Using Linux native AIO
150824 14:42:58 [Note] InnoDB: Using CPU crc32 instructions
150824 14:42:58 [Note] InnoDB: Initializing buffer pool, size = 128.0M
150824 14:42:58 [Note] InnoDB: Completed initialization of buffer pool
150824 14:42:58 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
150824 14:42:58 [ERROR] InnoDB: The system tablespace must be writable!
150824 14:42:58 [ERROR] Plugin 'InnoDB' init function returned error.
150824 14:42:58 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150824 14:42:58 [Note] Plugin 'FEEDBACK' is disabled.
150824 14:42:58 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
150824 14:42:58 [ERROR] Unknown/unsupported storage engine: InnoDB
150824 14:42:58 [ERROR] Aborting
150824 14:42:58 [Note] /usr/sbin/mysqld: Shutdown complete
150824 14:42:58 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
磁碟空間問題
答案1
這就是它無法啟動的原因:
150824 14:42:58 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13 "Permission denied")
150824 14:42:58 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
仔細檢查 /var/lib/mysql 的權限。另外,請檢查系統日誌以查看 SE-Linux 或 Apparmor 是否有乾擾。
答案2
所以我不知道你是否有同樣的問題,結果發現我的 my.cnf 中的設定與啟動不一致:
#innodb_lock_wait_timeout=1000;
事實證明;導致錯誤。去搞清楚。
答案3
使用以下命令來啟動和停止mysql
(尤其是debian 9
)
systemctl start mysql;
systemctl stop mysql;
這對我有用。