mysql 段错误 (core dumped)

时间:2023-03-08 18:18:42
一直使用好好的mysql命令,突然今天抽风,无论使用任何mysql选项都报“段错误 (core dumped)”,以为是mysqld程序出问题了,所以我尝试重启,因为我的环境上是多实例,用了mysqld_multi来管理,没想到一敲mysqld_multi命令也报错:
shell > /usr/local/mysql/bin/mysqld_multi stop 3306-3308
my_print_defaults: unknown option '-s'
my_print_defaults: unknown option '-s'
my_print_defaults: unknown option '-s'
my_print_defaults: unknown option '-s'
my_print_defaults: unknown option '-s'
这个-s选项是为了弥补5.6.x版本无法使用mysqld_multi命令stop实例的BUG而加的,之前用得好好的,突然这个也出问题了。
然后查看错误日志,没有发现任何错误信息,查看系统日志,也没发现什么有用信息
因为是测试环境,然后我直接把系统给reboot了,再次用mysql命令登录,还是报:段错误 (core dumped)
接着我查看一下命令路径:
shell > which mysql
/usr/bin/mysql
发现命令的路径是/usr/bin/mysql,而之前的路径是/usr/local/mysql/bin/mysql,估计是前两天安装一个依赖包的时候把yum的mysql包给安装了,查看下:
shell > rpm -qf `which mysql`
mysql-5.1.73-5.el6_6.x86_64
果然是这样,这里因为是测试环境,我就直接暴力一点cp /usr/local/mysql/bin下的命令覆盖掉/usr/bin/下的mysql相关的命令:
\cp -ar /usr/local/mysql/bin/* /usr/bin/
然后再次使用mysql命令登录,这次正常了:
[root@localhost ~]# mysql
Logging to file '/data/mysql/query.log'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
root@localhost Fri Jan 15 11:27:33 2016 11:27:33 [(none)]>
再试试mysqld_multi的停止与启动,发现也正常了
注:因为是测试环境,所以想命令简单点,偷个懒,没有写绝对路径,没想到踩坑了,线上环境还是建议使用绝对路径