
我已經透過以下命令在伺服器(Centos 7)中安裝了MySQL:
yum install -y mysql
yum install -y mysql-server
yum install -y mysql-devel
安裝後,我輸入mysql
並遇到錯誤
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/mysql/mysql.sock' (2)
我認為是因為我還沒有啟動MySQL服務,所以我輸入命令
service mysqld start
然後我收到訊息說Job for mariadb.service failed
這是內容/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
但是,該文件/var/lib/mysql/mysql.sock
在我的伺服器中不存在。順便說一句,SELINUX 是手動停用的。
mariadb.log
節目
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
InnoDB: Possible causes for this error:
(a) Incorrect log file is used or log file size is changed
(b) In case default size is used this log file is from 10.0
(c) Log file is corrupted or there was not enough disk space
In case (b) you need to set innodb_log_file_size = 48M
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGIN failed.
[ERROR] Unknown/unsupported storage engine: innodb
[ERROR] Aborting
答案1
我解決了這個問題,所以我想自己回答。如果這種自答行為不妥,請在下方提出評論。
總的來說,我透過找出文件中列出的問題來解決這個問題/var/log/mariadb/maridb.log
。
首先,我刪除了檔案./ib_logfile0
中指出超出大小限制的log
。然後,我嘗試使用enable
+ start
mariadb systemctl
,再次失敗。maridb.log
說Incorrect information in file './mysql/proxies_priv.frm'
。透過備份不正確的檔案並重新啟動mysql,maridb終於OK了。