【mysql】无法启动处理思路
时间:2015-03-17 01:03:50 作者:beebol 标签: mysql mysqld_safe 分类: mysql
如下是报错信息:
[root@WH-2-158 mysql_3301]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql_3301/my.cnf --pid-file=/data/mysql_3301/mysql.pid --socket=/data/mysql_3301/mysql.sock --ledir=/usr/local/mysql/libexec nohup: ignoring input and redirecting stderr to stdout Starting mysqld daemon with databases from /data/mysql_3301 mysqld_safe[20900]: started STOPPING server from pid file /data/mysql_3301/mysql.pid mysqld_safe[20906]: ended[root@WH-2-158 mysql_3301]# [root@WH-2-158 mysql_3301]#
1、检查mysql 错误日志,查看无任何错误日志产生;
2、检查数据库目录(datadir),程序所在目录(basedir)权限,都是mysql.mysql
看下配置文件也没有发现异常,如果配置文件异常也会有error日志吧!不用mysqld_safe启,直接用mysqld启动试试,这里就是不用配置文件是可以启动的。 如下已经正常启动。这里除了启动时带的参数外,其它都是默认的。
[root@WH-2-158 mysql_3301]# /usr/local/mysql/libexec/mysqld --datadir=/data/mysql_3301/ --basedir=/usr/local/mysql/ --pid-file=/data/mysql_3301/mysql.pid --socket=/data/mysql_3301/mysql.sock --user=mysql InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes InnoDB: than specified in the .cnf file 0 5242880 bytes! 150317 11:36:10 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.Version: '5.0.67-percona-highperf' socket: '/data/mysql_3301/mysql.sock' port: 3306 Source distribution Version: '5.0.67-percona-highperf' socket: '/data/mysql_3301/mysql.sock' port: 3306 Source distribution
这里应该是配置文件有问题了,但为什么没有日志产生呢,直接-x调试下mysqld_safe脚本。看下错误日志已经记录到系统日志里了。 (xxx 2>&1 |logger -p daemon.err -t mysqld_safe -i -t mysqld 这个是关键)
sh -x /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql_3301/my.cnf --pid-file=/data/mysql_3301/mysql.pid --socket=/data/mysql_3301/mysql.sock …… + rm -f /data/mysql_3301/mysql.sock /data/mysql_3301/mysql.pid + test -z '--port=3301 --socket=/data/mysql_3301/mysql.sock ' + eval 'nohup /usr/local/mysql/libexec/mysqld --defaults-file=/data/mysql_3301/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql_3301 --user=mysql --pid-file=/data/mysql_3301/mysql.pid --skip-external-locking --port=3301 --socket=/data/mysql_3301/mysql.sock 2>&1 | logger -p daemon.err -t mysqld_safe -i -t mysqld' ++ nohup /usr/local/mysql/libexec/mysqld --defaults-file=/data/mysql_3301/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql_3301 --user=mysql --pid-file=/data/mysql_3301/mysql.pid --skip-external-locking --port=3301 --socket=/data/mysql_3301/mysql.sock ++ logger -p daemon.err -t mysqld_safe -i -t mysqld + test '!' -f /data/mysql_3301/mysql.pid + echo 'STOPPING server from pid file /data/mysql_3301/mysql.pid' STOPPING server from pid file /data/mysql_3301/mysql.pid + break + echo ended + logger -p daemon.err -t mysqld_safe -i -smysqld_safe[22241]: ended mysqld_safe[22241]: ended
看下message日志,是有报错日志的,之前都没有注意,呵呵。
[root@WH-2-158 mysql_3301]#more /var/log/messages Mar 17 11:48:26 WH-2-158 mysqld[22238]: 150317 11:48:26 [Warning] option 'max_binlog_size': unsigned value 2147483648 adjusted to 10 73741824 Mar 17 11:48:26 WH-2-158 mysqld[22238]: 150317 11:48:26 [ERROR] /usr/local/mysql/libexec/mysqld: unknown variable 'erver-id=1085863301' 01'
然后尝试直接带配置文件再执行下果然报参数错误
[root@WH-2-158 mysql_3301]# nohup /usr/local/mysql/libexec/mysqld --defaults-file=/data/mysql_3301/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql_3301 --user=mysql --pid-file=/data/mysql_3301/mysql.pid --skip-external-locking --port=3301 --socket=/data/mysql_3301/mysql.sock nohup: ignoring input and appending output to `nohup.out' [root@WH-2-158 mysql_3301]# ls bak ibdata1 ib_logfile1 my.cnf mysql query.log test error.log ib_logfile0 innodb_status.2198 my.cnf.bak nohup.out slow.log [root@WH-2-158 mysql_3301]# tail nohup.out 150317 11:49:01 [Warning] option 'max_binlog_size': unsigned value 2147483648 adjusted to 1073741824 150317 11:49:01 [ERROR] /usr/local/mysql/libexec/mysqld: unknown variable 'erver-id=1085863301'[root@WH-2-158 mysql_3301]# [root@WH-2-158 mysql_3301]#
一个致命错误,一个warning,修复参数后,正常启动OK。