Mysql 每次重启都会崩溃

Mysql crashes on every reboot

我在 digitalocean (1G RAM) 上有 VPS (Ubuntu 14.04) 并且我安装了 VestaCP。每次我重新启动服务器 mysql 由于内存不足(它缓冲超过 1G)而崩溃,尽管我为我的 RAM(我的 /etc/mysql/my.cnf)配置了:

    [client]
port=3306
socket=/var/run/mysqld/mysqld.sock

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock

[mysqld]
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log
max_user_connections=30
wait_timeout=30
interactive_timeout=50
long_query_time=5
innodb_file_per_table

#fibhost 1G RAM
key_buffer_size                 = 8M
query_cache_size                = 0M
tmp_table_size                  = 64M
innodb_buffer_pool_size         = 128M
innodb_additional_mem_pool_size = 8M
innodb_log_buffer_size          = 8M
max_connections                 = 150

sort_buffer_size                = 4M
read_buffer_size                = 128k
read_rnd_buffer_size            = 256k
join_buffer_size                = 128M
thread_stack                    = 256k
binlog_cache_size               = 32k

!includedir /etc/mysql/conf.d/

当我 sudo service mysql 重新启动时,它会正常工作并缓冲 550M 直到下次重新启动 shutdown -r +5reboot

/var/log/mysql/error.log:

150529  0:36:43 InnoDB: Could not open or create data files.
150529  0:36:43 InnoDB: If you tried to add new data files, and it failed here,
150529  0:36:43 InnoDB: you should now edit innodb_data_file_path in my.cnf back
150529  0:36:43 InnoDB: to what it was, and remove the new ibdata files InnoDB created
150529  0:36:43 InnoDB: in this failed attempt. InnoDB only wrote those files full of
150529  0:36:43 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
150529  0:36:43 InnoDB: remove old data files which contain your precious data!
150529  0:36:43 [ERROR] Plugin 'InnoDB' init function returned error.
150529  0:36:43 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150529  0:36:43 [ERROR] Unknown/unsupported storage engine: InnoDB
150529  0:36:43 [ERROR] Aborting

150529  0:36:43 [Note] /usr/sbin/mysqld: Shutdown complete

150529 00:36:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

1GB 对于今天来说太小了。 my.cnf 中的 64M 和 128M 设置减半;也许这会让您 运行 内存不足。

日志文件听起来 MySQL 想要放置其内容的目录或其中的文件存在权限问题。不要直接从非 root 用户 运行 mysqld;服务命令可能是 "right" 方式。