今天只是想发表个感慨,同时将这部分教训写出来,让大家有个经验,很简单的mysql数据库搭建,网上有很多安装教程,不用多说。
我只是把我安装后遇到的问题写出来,给自己提个醒,MySQL数据库装完之后(是卸载删除了以前的mysql重装的),我就直接启动mysql服务,service mysql restart ,发现报出如下错误。
[[email protected] mysql]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL...The server quit without updating PID file [FAILED]ysql/localhost.localdomain.pid).
这是第一次报错,很明显和大家想的一样,肯定是端口或进程占用神马的,执行ps -ef|grep mysql
[[email protected] mysql]# ps -ef |grep mysql
root 4084 1 1 14:06 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid
mysql 4407 4084 6 14:06 pts/0 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/data/mysql/mysql.sock --port=3306
root 4437 2771 0 14:06 pts/0 00:00:00 grep mysql
发现进程果然没清干净,有残留, 很简单 直接kill -9 4437 (进程号)干掉,当时服务就正常启动了
后面我要配置MySQL主从数据库,这块网上也有很多参考,当时配置完成后直接就重启服务,开始验证主从关系,当时发现从库开启 start slave ,show slave status\G ,发现I/O进程为NO ,很明显我发现肯定是my.cnf主从配置文件哪里出了错,当时也是心急,估计是某个键按错,还自以为是对的,没有细细核对,接着我就reboot 从库,就出现了后面mysql 无法启动
这是也是如大家一样,网上查找方案和类似案例,kill 进程,关闭selinux 查看数据目录权限等
重新设置数据权限:chown mysql.mysql /data/mysql/,问题依旧存在,
打开日志 经验不足,以为错误就显示在近期时间 (这是我的习惯***错误习惯,勿要学习)
tail -30 /data/mysql/localhost.localdomain.err (日志文件路径依情况而定),
160428 13:18:04 [Note] Shutting down plugin ‘MEMORY‘
160428 13:18:04 [Note] Shutting down plugin ‘MRG_MYISAM‘
160428 13:18:04 [Note] Shutting down plugin ‘mysql_old_password‘
160428 13:18:04 [Note] Shutting down plugin ‘mysql_native_password‘
160428 13:18:04 [Note] Shutting down plugin ‘binlog‘
160428 13:18:04 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
160428 13:18:04 mysqld_safe mysqld from pid file /data/mysql/localhost.localdomain.pid ended
160428 13:19:43 mysqld_safe Starting mysqld daemon with databases from /data/mysql
160428 13:19:43 InnoDB: The InnoDB memory heap is disabled
160428 13:19:43 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160428 13:19:43 InnoDB: Compressed tables use zlib 1.2.3
160428 13:19:43 InnoDB: CPU supports crc32 instructions
160428 13:19:43 InnoDB: Initializing buffer pool, size = 128.0M
160428 13:19:43 InnoDB: Completed initialization of buffer pool
160428 13:19:43 InnoDB: highest supported file format is Barracuda.
160428 13:19:43 InnoDB: 128 rollback segment(s) are active.
160428 13:19:43 InnoDB: Waiting for the background threads to start
160428 13:19:44 InnoDB: 1.2.4 started; log sequence number 1603097
160428 13:19:44 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable ‘lob-bin=mysql=bin‘
160428 13:19:44 [ERROR] Aborting
160428 13:19:44 [Note] Binlog end
160428 13:19:44 [Note] Shutting down plugin ‘partition‘
160428 13:19:44 [Note] Shutting down plugin ‘PERFORMANCE_SCHEMA‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_FOREIGN_COLS‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_FOREIGN‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_FIELDS‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_COLUMNS‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_INDEXES‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_TABLESTATS‘
160428 13:19:44 [Note] Shutting down plugin ‘INNODB_SYS_TABLES‘
发现 /etc/my.cnf 配置文件有处地方写错了 加粗显示,当时很开心,直接就更正过来了,然后重启发现mysql服务依旧不行,这时我就尴尬了,各种搜索,其中我发现日志有个记录是这个
160428 13:18:04 mysqld_safe mysqld from pid file /data/mysql/localhost.localdomain.pid ended
对着百度,谷歌就搜索,但大多解决方法无非我前面提到的几步,在不知不觉中,我已经耗时2个多小时了,正准备重装,忽然将日志往前面多翻了几行,这时发现一个error ,我欣喜半天
160428 11:05:35 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable ‘replucate-ignore-db=mysql‘
160428 11:05:35 [ERROR] Aborting
发现单词写错了,真是2的不幸啊, 更正过来之后,全都正常启动了
这次记录只为对自己粗心大意提个醒!!!!
正常启动如下:
[[email protected] ~]# !se
service mysql restart
Shutting down MySQL.. [ OK ]
Starting MySQL.. [ OK ]
好了,到此结束对自己的谴责