1.BACKUP database: Mysqldump-u[user]-p[password] [databasename] > [dbfile.sql] # Back up the database.
2./usr/local/mysql/bin/mysqladmin-u root-p Shutdown #Stop the database orservice MySQL stop.
3. InnoDBThe table does not support full-text search, so remember to fulltext the backed-up database SQL and delete the index about fulltext.
4. cd/usr/local/mysql/support-files/find the appropriate settings for host memory files, will be set to copy files to/etc/my.cnf.
5. Vi/etc/my.cnf, cancel the following comments. Take my-large.cnf as an example.
Innodb_data_file_path = Ibdata1:10m:autoextend
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
Innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
Plus default-storage-engine=innodb
Add this paragraph, after the new data table Form is InnoDB, or every time you add a data table, SQL is added after Engine=innodb;
6. Convert The SQL that you just backed up and change the Engine=myisam to Engine=innodb.
7./usr/local/mysql/bin/safe_mysqld--user=mysql &, or service MySQL start database
8. Create a new database (the database name is the same as the database name backed up).
9. Mysql-u[user]-p[password] [database_name] < [dbfile] # Import the changed data into the database!
Description:
* the selection of the settings file is selected by reference to the memory size.
my-huge.cnf-1g~2g, my-large.cnf-512m,my-medium.cnf-32m-64m, my-small.cnf <= 64M.
InnoDB:my-innodb-heavy-4g.cnf
* If the backed up database is not modified, you can use the following command, directly changes the form of the data table.
ALTER TABLE [tablename] Engine=innodb the conversion will fail if the full-text indexing function is stored.
* If you have a batch of data sheets to change, you can use the following instructions:
Mysql_convert_table_format [opt]-- Engine=innodb dbname [tablename]
But be careful not to change the MySQL database data type, because the MySQL database is stored in the internal MySQL management information, so must maintain the MyISAM format.
* Increase tablespace Space :
Innodb_data_file_path = ibdata1:1g;ibdata2:1g:autoextend:max2g
The above means that tablespace contains two files of Ibdata1 & Ibdata2, and if the file does not exist, a file of 1G capacity is created. Once the future InnoDB needs more space, the IBDATA2 will automatically increase by 8MB each time until 2G.
How to convert MySQL MyISAM library to InnoDB