MySQL could not launch several common problem summaries

  • 2020-06-01 11:09:42
  • OfStack

Yesterday, I saw a new student in the group still asking the question that MySQL could not be started, so I summarized a few common situations.

Problem 1: the directory and file permissions are not set correctly

The $datadir directory of MySQL and its subordinate directories and file permissions are not set correctly, so MySQL cannot read and write files normally and cannot be started.
Error messages such as:

[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 


Problem 2: port conflicts

Other instances of mysqld have been started and occupy the same port, and the port option needs to be modified.
Error messages such as:

 
[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 is not configured correctly

The Settings of datafile and log file in innodb are not correct, so it cannot be started. In particular, it was started with default parameters for the first time, and then after referring to some optimization guidelines, the parameters of innodb were modified, which will prompt different size. Detailed errors include:

 
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. 


Problem 4: the mysql system library is not initialized

After installing MySQL, you need to run mysql_install_db to initialize the mysql system library to start properly.

Question 5: when running mysql with normal user permissions, you need to pay attention to some directory permissions and user name and password Settings

Sometimes, in order to make mysql more secure, we will run mysql with low permissions. Due to some security Settings tools, we need to reset the user's password for 1 time.


This time list the above common problems, next time to add.

Generally, encounter mysqld process cannot be started, regardless of any error, give priority to check the error log (log files as in $1 datadir/xx err file, or is/var log/message, / var log/mysql/mysqld log), based on the error log to find the problem reason, don't just see the surface tips, such as can not find mysql. sock files and so on.

Related articles: