安装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

之后就可以了,以后有什么错误就到日志里去看详细的提示~~

猜你喜欢

转载自blog.csdn.net/qq_34770694/article/details/85121849