Home  >  Article  >  Operation and Maintenance  >  Mysql fails to start under linux

Mysql fails to start under linux

王林
王林Original
2019-12-04 09:48:373614browse

Mysql fails to start under linux

1. Check the startup log

Find the location of the mysql configuration file /etc/my.cf

The error message is as follows:

nnoDB: Data file ./ibdata1 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file 1280 pages!

Error reason :

Data file sizes do not match.

Linux video tutorial recommendation: linux video tutorial

2. Check the file size of ibdata1

Find the installation location of mysql/var/ run/mysql

The example is as follows:

[root@localhost mysql]# ll -lh
total 21M
-rw-rw----. 1 mysql mysql  10M Apr  1 09:23 ibdata1
-rw-rw----. 1 mysql mysql 5.0M Apr  1 09:23 ib_logfile0
-rw-rw----. 1 mysql mysql 5.0M Mar 13 07:43 ib_logfile1
drwx------. 2 mysql mysql 4.0K Mar 13 07:43 mysql
drwx------. 2 mysql mysql 4.0K Mar 13 07:43 test

3. Set the size of ibdata1 to be consistent with the viewed size /etc/my.cnf

Examples are as follows:

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
innodb_data_file_path=ibdata1:10M;ibdata2:10M:autoextend

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of Mysql fails to start under linux. 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