1. Roll back and reinstall mysql
In order to avoid the trouble of importing this data from other places, first reinstall the current database Make a backup of the database file (/var/lib/mysql/location). Next, I uninstalled the Percona server 5.7 package, reinstalled the original 5.1.71 package, and started the mysql service. It prompted Unknown/unsupported table type: innodb and could not start normally.
110509 12:04:27 InnoDB: Initializing buffer pool, size = 384.0M 110509 12:04:27 InnoDB: Completed initialization of buffer pool InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes InnoDB: than specified in the .cnf file 0 157286400 bytes! 110509 12:04:27 [ERROR] Plugin 'InnoDB' init function returned error. 110509 12:04:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 110509 12:04:27 [ERROR] Unknown/unsupported table type: innodb 110509 12:04:27 [ERROR] Aborting 110509 12:04:27 [Note] /usr/sbin/mysqld: Shutdown complete
Delete the /var/lib/mysql/ directory, restart the database service, and initialize it. It is found to be normal. Show engines can find the innodb engine. Then stop the database, overwrite the contents of the previously backed up /var/lib/mysql/ directory with the contents of the current location, and restart. I also found that it could not be started, and the error content was the same as before.
The structure of the contents of the /var/lib/mysql directory is as follows:
-rw-rw---- 1 mysql mysql 10485760 2月 26 18:10 ibdata1 -rw-rw---- 1 mysql mysql 5242880 2月 26 18:10 ib_logfile0 -rw-rw---- 1 mysql mysql 5242880 2月 26 17:20 ib_logfile1 drwx------ 2 mysql mysql 4096 2月 26 17:20 mysql drwx------ 2 mysql mysql 4096 2月 26 17:24 wiki
The wiki directory is the library for test data, the ibdata1 file is the data file, the two files starting with ib are log files, mysql The directory contains system library-related things. Use the initialized data again, and overwrite the wiki directory and ibdata1 file to the /var/lib/mysql directory. You can start normally and log in normally.
2. Reinstall the innodb module
However, when backing up through mysqldump, it prompts unknown table engine "Innodb". After logging in, check all the current engine types and find that the innodb type does not exist among them:

Use the alter command to modify the type of one of the tables to MyISAM. , and found that an error was still reported.

Through find, it is found that there is a ha_innodb_plugin.so file in the /usr/lib64/mysql/plugin/ directory. I have the impression that later versions of mysql5 support online plug-in installation. Check the following to confirm that it is indeed supported:

install plugin innodb soname 'ha_innodb.so';3. BackupIn Add the following configuration to /etc/my.cnf:
plugin-load=innodb=ha_innodb_plugin.so plugin_dir=/usr/lib64/mysql/plugin/ default-storage-engine=InnoDBFound that the startup still failed. Check mysql-error.log and find the following content:
InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 7. InnoDB: You may have to recover from a backup. InnoDB: It is also possible that your operating InnoDB: system has corrupted its own file cache InnoDB: and rebooting your computer removes the InnoDB: error. InnoDB: If the corrupt page is an index page InnoDB: you can also try to fix the corruption InnoDB: by dumping, dropping, and reimporting InnoDB: the corrupt table. You can use CHECK InnoDB: TABLE to scan your table for corruption. InnoDB: See also http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.htmlOpen the official forcing-innodb-recovery page and find that you can force startup and recovery by specifying the innodb_force_recovery parameter. Add the following content to /etc/my.cnf:
innodb_force_recovery=6Restart successful. There is no problem with backing up through mysqldump. Importing the backup data to other hosts can also be found to be normal and can be tested. Now it’s easy. Delete mysql completely and reinstall Percona server 5.7. After installation, build the database, restore the data, reconnect the program, and everything is OK.
The above is the detailed content of How to handle mysql innodb exception. For more information, please follow other related articles on the PHP Chinese website!

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

Subqueries can improve the efficiency of MySQL query. 1) Subquery simplifies complex query logic, such as filtering data and calculating aggregated values. 2) MySQL optimizer may convert subqueries to JOIN operations to improve performance. 3) Using EXISTS instead of IN can avoid multiple rows returning errors. 4) Optimization strategies include avoiding related subqueries, using EXISTS, index optimization, and avoiding subquery nesting.

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Renaming a database in MySQL requires indirect methods. The steps are as follows: 1. Create a new database; 2. Use mysqldump to export the old database; 3. Import the data into the new database; 4. Delete the old database.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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 Mac version
God-level code editing software (SublimeText3)

Dreamweaver Mac version
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
