MySQL无法启动几种常见问题小结_MySQL
bitsCN.com
昨天在群里看到有新同学还在问MySQL无法启动的问题,于是总结了几个常见情况,权当普及帖了,老鸟自觉飞过。
问题1:目录、文件权限设置不正确
MySQL的$datadir目录,及其下属目录、文件权限属性设置不正确,导致MySQL无法正常读写文件,无法启动。
错误信息例如:
[code]
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
问题2:端口冲突
已有其他mysqld实例启动,且占用了相同端口,需要修改 port 选项。
错误信息例如:
[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
问题3:innodb配置不正确
innodb中关于datafile、log file设置不正确,导致无法启动。尤其是第一次用默认参数启动过,后来又参考一些优化指南后,修改了innodb的参数,会提示different size,详细错误例如:
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.
问题4:没有初始化mysql系统库
MySQL安装完后,需要运行mysql_install_db初始化mysql这个系统库,才能正常启动。
问题5:如果将mysql以普通用户权限运行的时候需要注意一些目录权限与用户名密码设置
有时候为了让mysql更安全一些,我们都会将mysql低权限运行,由于一些安全设置工具的原因,需要将此用户重新设置一下密码就可以了。
本次先列举上述几个常见问题,下次再补充。
通常地,碰到mysqld进程无法启动时,不管任何错误,都优先检查错误日志(日志文件一般在 $datadir/xx.err文件,或者是 /var/log/message、/var/log/mysql/mysqld.log之类的),根据错误日志提示去找到问题原因,不要只看表面提示,例如找不到 mysql.sock 文件之类的。bitsCN.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.
