We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.7.15. Changing the storage type

Storage type conversions in MySQL tables, for example, from MyISAM to InnoDB, can be done in the following ways:
To change the storage type of individual tables, connect to the database with phpMyAdmin or any other MySQL client and for the tables you want execute SQL query kind:

Where instead of table_name specify the desired table, and instead of InnoDB - the type of storage engine you want.

To change the storage type for all tables in the database, use the console program mysql (to use it you need connect via SSH to the hosting server). To convert all tables to InnoDB run:
for n in `mysql -h host -u login -pPASSWORD name_БД -B -N -e "show tables;"`;do mysql -h host -u login -pPASSWORD name_БД -B -N -e "ALTER TABLE $n ENGINE=innodb;";done

In the specified command, you need to specify connection data to the database:

  • host - database server.
  • login - the name of the database user.
  • PASSWORD - database user password.
  • name_БД - the name of the database.
  • innodb - storage type.

Important! All data, except for the storage type, must be changed twice in the command. When you run the command, the output might look like this:

mysql: [Warning] Using a password on the command line interface can be insecure.

Do not be intimidated by such a message, this notification only indicates that using a password in a command is unsafe. If there is no other data, then the command was executed correctly.