Home  >  Article  >  Database  >  Several common problems when mysql cannot be started

Several common problems when mysql cannot be started

怪我咯
怪我咯Original
2017-07-06 11:26:531723browse

I saw in the group that some new students were still asking about MySQL not being able to start, so I summarized several common situations and solutions. Friends who need them can refer to them.

I saw some in the group yesterday. The new students were still asking about the problem of MySQL not being able to start, so they summarized a few common situations and thought of it as a popular post.

Problem 1: Directory and file permission settings are incorrect

MySQL’s $datadir directory, and its subordinate directories and file permissions The attribute is set incorrectly, causing MySQL to be unable to read and write files normally and unable to start.
Error messageFor example:
The code is as follows:

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


Problem 2: Port conflict

Other mysqld instances have been started and occupy the same port. The port option needs to be modified.
Error message for example:
The 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: Innodb configuration is incorrect

innodb The settings for datafile and log file are incorrect, resulting in failure to start. Especially when I started it with default parameters for the first time, and then after referring to some optimization guides, I modified the parameters of innodb, and it will prompt different size. Detailed errors are for example:

The 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' registration as a STORAGE ENGINE failed.


Question 4: The mysql system library is not initialized

After MySQL is installed, you need to run mysql_install_db to initialize the mysql system library before it can start normally.

Question 5: If you run mysql with normal user permissions, you need to pay attention to some directory permissions and username and password settings

Sometimes in order to make mysql update For safety, we will all run mysql with low permissions. Due to some security settings tools, we need to reset the password for this user.

This time I will list the above frequently asked questions, and I will add them next time.

Normally, when the mysqld process cannot be started, regardless of any errors, the error log will be checked first (the log file is usually in the $datadir/xx.err file, or /var/log/message, /var /log/mysql/mysqld.log, etc.), follow the error log prompts to find the cause of the problem, do not just look at the superficial prompts, such as the mysql.sock file cannot be found.

The above is the detailed content of Several common problems when mysql cannot be started. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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