Yesterday, I saw a new student in the Group still asking questions about MySQL startup failure. So I summarized several common cases, so I had the right to popularize the post and the old bird flew over.
Problem 1: Incorrect directory and file permission settings
The $ datadir directory of MySQL and its subordinate directories and File Permission attributes are incorrectly set. As a result, MySQL cannot read and write files normally and cannot start.
The error message is as follows:
Copy codeThe code is as follows: [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
Question 2: port conflict
If another mysqld instance is started and occupies the same port, You need to modify the port option.
The error message is as follows:
Copy codeThe Code is as follows:
[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
Problem 3: the innodb configuration is incorrect.
The datafile and log file Settings in innodb are incorrect, causing startup failure. Especially when the default parameter is used for the first time, and then the innodb parameter is modified by referring to some optimization guidelines, the different size will be displayed, for example:
Copy codeThe Code is as follows:
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' registry as a storage engine failed.
Problem 4: The mysql system library is not initialized.
After MySQL is installed, you must run mysql_install_db to initialize the mysql system library.
Question 5: when running mysql with the common user permission, you need to pay attention to the directory permission and user name and password settings.
Sometimes, to make mysql more secure, we will run mysql with low permissions. Due to some security setting tools, you need to reset the user's password.
This time, we will list the above several common problems and add them again.
Generally, when the mysqld process cannot be started, check the Error Log First regardless of any errors. (The log file is usually at $ datadir/xx. err file, or/var/log/message,/var/log/mysql/mysqld. according to the error log prompt, do not look at the surface prompt, for example, cannot find mysql. sock files.