Home > Database > Mysql Tutorial > 几种常见MySQL无法启动案例_MySQL

几种常见MySQL无法启动案例_MySQL

WBOY
Release: 2016-06-01 13:30:47
Original
895 people have browsed it

  昨天在群里看到有新同学还在问MySQL无法启动的问题,于是总结了几个常见情况,权当普及帖了,老鸟自觉飞过。

 问题1:目录、文件权限设置不正确

  MySQL的$datadir目录,及其下属目录、文件权限属性设置不正确,导致MySQL无法正常读写文件,无法启动。
错误信息例如:

1

2

mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/imysql.local.err: Permission denied

Copy after login

 问题2:端口冲突

  已有其他mysqld实例启动,且占用了相同端口,需要修改 port 选项。

  错误信息例如:

1

2

3

[ERROR] Can't start server: Bind on TCP/IP port: Address already in use

[ERROR] Do you already have another mysqld server running on port: 3306 ?

[ERROR] Aborting

Copy after login

 问题3:innodb配置不正确

  innodb中关于datafile、log file设置不正确,导致无法启动。尤其是第一次用默认参数启动过,后来又参考一些优化指南后,修改了innodb的参数,会提示different size,详细错误例如:

1

2

3

4

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes

InnoDB: than specified in the .cnf file 0 134217728 bytes!

[ERROR] Plugin ‘InnoDB’ init function returned error.

[ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.

Copy after login

 问题4:没有初始化mysql系统库

  MySQL安装完后,需要运行mysql_install_db初始化mysql这个系统库,才能正常启动。

  本次先列举上述几个常见问题,下次再补充。

  通常地,碰到mysqld进程无法启动时,不管任何错误,都优先检查错误日志(日志文件一般在 $datadir/xx.err文件,或者是 /var/log/message、/var/log/mysql/mysqld.log之类的),根据错误日志提示去找到问题原因,不要只看表面提示,例如找不到 mysql.sock 文件之类的。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template