Example tutorial of converting myisam to innodb in MySQL
Converting myisam to innodb requires modifying the storage engine of the table. If you do not modify myisam to innodb according to the standard method, it may cause database damage and data loss. Let’s look at the correct myisam conversion. innodb method.
<script>ec(2);</script>
Here is a brief introduction to the differences and conversion methods between the two:
MyISAM: MyISAM is the default database storage engine for versions prior to MySQL5.5. MYISAM provides high-speed storage and retrieval, as well as full-text search capabilities, and is suitable for applications with frequent queries such as data warehouses. But it does not support transactions or foreign keys. An important flaw of the MyISAM format is that data cannot be restored after the table is damaged.
InnoDB: InnoDB is the default database storage engine of MySQL version 5.5. However, InnoDB has been acquired by Oracle. Falcon, a new storage engine developed by MySQL, will be introduced in MySQL version 6.0. InnoDB is transaction safe with commit, rollback and crash recovery capabilities. However, compared to the MyISAM storage engine, InnoDB writes less efficiently and takes up more disk space to retain data and indexes. Nonetheless, InnoDB includes support for transactions and foreign keys, both of which are not available in the MyISAM engine.
MyISAM is suitable for: (1) Doing a lot of count calculations; (2) Insertions are infrequent and queries are very frequent; (3) There are no transactions.
InnoDB is suitable for: (1) situations where reliability requirements are relatively high, or transactions are required; (2) table updates and queries are quite frequent, and the chance of table locking is relatively high. (4) Servers with better performance, such as separate database servers, such as Alibaba Cloud's relational databaseRDS, recommend the InnoDB engine.
MySQL generally provides a variety of storage engines, which can be viewed by executing the following instructions:
First enter MySQLCommand line mode
View what storage MySQL provides Engine:
mysql> show engines;
View MySQL's current default storage engine:
mysql> show variables like '%storage_engine%';
Query wpsql library
mysql> use wpsql;
List all table names in the current library
mysql> show tables;
You need to see what engine is used for the wp_posts table (in the display results, the parameter after the engine It indicates the storage engine currently used by the table):
mysql> show create table wp_posts;
Modify the wp_posts table to the InnoDB storage engine (you can also use this command to replace InnoDB with MyISAM):
mysql> ALTER TABLE wp_posts ENGINE=INNODB;
If you want to change the storage engine of the entire database table, you generally need to modify one table by one, which is relatively cumbersome. You can export the database first, get SQL, and replace all MyISAM with INNODB. , and thenimport the database way.
Restart mysql after the conversion is completed
> service mysqld restart
The above is the detailed content of Example tutorial of converting myisam to innodb in MySQL. For more information, please follow other related articles on the PHP Chinese website!

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

After rain in summer, you can often see a beautiful and magical special weather scene - rainbow. This is also a rare scene that can be encountered in photography, and it is very photogenic. There are several conditions for a rainbow to appear: first, there are enough water droplets in the air, and second, the sun shines at a low angle. Therefore, it is easiest to see a rainbow in the afternoon after the rain has cleared up. However, the formation of a rainbow is greatly affected by weather, light and other conditions, so it generally only lasts for a short period of time, and the best viewing and shooting time is even shorter. So when you encounter a rainbow, how can you properly record it and photograph it with quality? 1. Look for rainbows. In addition to the conditions mentioned above, rainbows usually appear in the direction of sunlight, that is, if the sun shines from west to east, rainbows are more likely to appear in the east.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

The expansion of the virtual market is inseparable from the circulation of virtual currency, and naturally it is also inseparable from the issue of virtual currency transfers. A common transfer error is the address copy error, and another error is the chain selection error. The transfer of virtual currency to the wrong chain is still a thorny problem, but due to the inexperience of transfer operations, novices often transfer the wrong chain. So how to recover the wrong chain of virtual currency? The wrong link can be retrieved through a third-party platform, but it may not be successful. Next, the editor will tell you in detail to help you better take care of your virtual assets. How to retrieve the wrong chain of virtual currency? The process of retrieving virtual currency transferred to the wrong chain may be complicated and challenging, but by confirming the transfer details, contacting the exchange or wallet provider, importing the private key to a compatible wallet, and using the cross-chain bridge tool
