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

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

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

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

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]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

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


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

Atom editor mac version download
The most popular open source editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
