1. 程式人生 > >安裝mysql5.6出現的一個擾人錯誤

安裝mysql5.6出現的一個擾人錯誤

今天在阿里雲的伺服器上安裝mysql5.6時一直報以下錯誤

Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/mysql/mysql.pid).

在這裡插入圖片描述
百度了下,看到好多博主的各種解決方法,什麼缺檔案,沒許可權之類的,都一一試了下,發現還是不行。
最後是檢視日誌,發現有下面的錯誤提示

InnoDB: Cannot allocate memory for the buffer pool

在這裡插入圖片描述
原來是因為我的阿里雲伺服器是很低配版的,無法給innodb分配足夠的記憶體。所以就在/etc/my.cnf配置檔案中增加下面語句

innodb_buffer_pool_size=50M

再次啟動mysql

service mysqld start

在這裡插入圖片描述
這次就成功了。
哎,以後還是要學會多多看日誌呀。
備註:如果找不到日誌,可以先在/etc/my.cnf配置裡新增

log-error =/usr/local/mysql/data/mysql/logs/error.log

如果出現找不到該檔案的錯誤提示
手動在/data/mysql/logs/目錄下新建一個log檔案

touch error.log

接下來如果還報錯

Starting MySQL.181220 13:56:27 mysqld_safe error: log-error set to '/data/mysql/logs/error.log', however file don't exists. Create writable for user 'mysql'.

在這裡插入圖片描述
設定下mysql使用者的許可權

chown mysql. error.log

之後就可以了,以後有什麼錯誤就到日誌裡去看詳細的提示~~