MySQL Server 5.6不会在CentOS 7上启动

时间:2015-08-09 20:18:06

标签: mysql centos centos7

我在运行最新CentOS 7的DigitalOcean上有512MB VPS。使用这些命令安装了MySQL 5.6:

yum localinstall http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

我正在使用以下 my.cnf

[mysql]

# CLIENT #
port                           = 3306
socket                         = /var/lib/mysql/mysql.sock

[mysqld]

# GENERAL #
user                           = mysql
default-storage-engine         = MyISAM
socket                         = /var/lib/mysql/mysql.sock
pid-file                       = /var/lib/mysql/mysql.pid

# MyISAM #
key-buffer-size                = 128M
myisam-recover                 = FORCE,BACKUP

# SAFETY #
max-allowed-packet             = 16M
max-connect-errors             = 1000000

# DATA STORAGE #
datadir                        = /var/lib/mysql/

# CACHES AND LIMITS #
tmp-table-size                 = 32M
max-heap-table-size            = 32M
query-cache-type               = 0
query-cache-size               = 0
max-connections                = 500
thread-cache-size              = 100
open-files-limit               = 65535
table-definition-cache         = 4096
table-open-cache               = 100

# LOGGING #
log-error                      = /var/lib/mysql/mysql-error.log
log-queries-not-using-indexes  = 0
slow-query-log                 = 0
slow-query-log-file            = /var/lib/mysql/mysql-slow.log

当我尝试使用这些命令变体启动MySQL时,没有任何问题:

[root@server ~]# /etc/init.d/mysql start
-bash: /etc/init.d/mysql: No such file or directory

[root@server ~]# /etc/init.d/mysqld start
-bash: /etc/init.d/mysqld: No such file or directory

所以,我试过这个方法:

[root@server ~]# service mysql start
Redirecting to /bin/systemctl start  mysql.service

它一直停留在那条消息上,没有任何事情发生。我已经检查了 ps aux | grep mysql 并且我没有看到正在运行的服务:

[root@server ~]# ps aux | grep mysql
root     10688  0.0  0.1 115212   644 ?        Ss   20:08   0:00 /bin/bash /usr/bin/mysql-systemd-start post
root     12646  0.0  0.2 132520  1396 pts/0    S+   20:16   0:00 /bin/systemctl start mysql.service
root     12852  0.0  0.1 112640   960 pts/1    S+   20:17   0:00 grep --color=auto mysql

有什么想法吗?

3 个答案:

答案 0 :(得分:3)

MySQL 5.6不会在没有交换的512M VM上启动。该错误很可能是内存不足的情况。您可以选择:

  1. 安装MySQL 5.7(目前为RC2)。您使用的存储库具有此可用as an option。 5.7 in it的默认配置实际上使用较少的RAM。

  2. 修改5.6服务器的配置以使用更少的RAM。我有一个例子available here

  3. 启用交换。

答案 1 :(得分:3)

对于CentOS 7,mysql正在转换为mariadb。在/ usr / lib / systemd / system下应该找到mariadb.service文件。然后只需运行

  

sudo systemctl start mariadb.service

然后当你运行/ usr / bin / mysql时,它可以工作!

答案 2 :(得分:0)

我认为您需要启用交换内存。试试这个。

使用CentOS 7启用交换内存ram

$ sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ swapon -s