【发布时间】:2018-04-26 08:38:52
【问题描述】:
我不知道是什么进程杀死了它。我在 CentOS 的经验为零。首先它没有开始使用
service mysqld start
并显示错误
/usr/bin/mysqld_safe: line 183: 7618 Killed nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/null > /dev/null 2>&1
/usr/bin/mysqld_safe: line 183: 7675 Killed nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/null > /dev/null 2>&1 > /dev/null 2>&1
所以我在某处阅读以运行以下命令
sudo service httpd restart
然后mysqld正常启动,但在10-15秒内又出现上述错误。我认为某些进程正在强行杀死它。
这里是mysqld.log
Version: '5.6.38' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
2017-11-14 12:02:07 1535 [Note] Plugin 'FEDERATED' is disabled.
2017-11-14 12:02:07 1535 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-11-14 12:02:07 1535 [Note] InnoDB: The InnoDB memory heap is disabled
2017-11-14 12:02:07 1535 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-11-14 12:02:07 1535 [Note] InnoDB: Memory barrier is not used
2017-11-14 12:02:07 1535 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-11-14 12:02:07 1535 [Note] InnoDB: Using Linux native AIO
2017-11-14 12:02:07 1535 [Note] InnoDB: Using CPU crc32 instructions
2017-11-14 12:02:07 1535 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-11-14 12:02:07 1535 [Note] InnoDB: Completed initialization of buffer pool
命令free -m 显示下面的输出以防万一。
total used free shared buffers cached
Mem: 512 280 231 128 0 7
-/+ buffers/cache: 272 239
Swap: 256 207 48
下面是我的my.cnf 文件。
[mysqld]
bind_address = 0.0.0.0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
thread_cache_size=4
join_buffer_size=4M
sort_buffer_size=4M
read_buffer_size=4M
read_rnd_buffer_size=6M
myisam_sort_buffer_size=64M
key_buffer_size=128M
tmp_table_size=128M
max_heap_table_size=128M
query_cache_size=256M
query_cache_type=1
default-storage-engine=myisam
#skip-innodb
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
导致该错误和杀死 mysqld 的原因是什么,我该如何解决?
【问题讨论】:
-
你试过打开日志看看发生了什么吗?
-
看起来是内存问题...检查 mysql/mariadb 是否内存不足。见here
-
首先,它是在接近后开始的,但现在它甚至在 50% 的 MB RAM 空闲时也没有开始。看起来其他进程正在杀死它。