Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Database Server
  • Search

from ''MyISAM'' to ''InnoDB'' and conversely

Questions regarding the Database Server
MySQL, PostgreSQL, MariaDB, Percona Server, phpMyAdmin, phpPgAdmin
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
vestacp89
Posts: 83
Joined: Thu Aug 14, 2014 11:04 am

from ''MyISAM'' to ''InnoDB'' and conversely
  • Quote

Post by vestacp89 » Sat Mar 14, 2015 7:41 pm

Hello,

How i can change ''MyISAM'' to ''InnoDB'' ?
and conversely ?

Thanks.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: from ''MyISAM'' to ''InnoDB'' and conversely
  • Quote

Post by skurudo » Sat Mar 14, 2015 10:20 pm

mysql / phpmyadmin - http://dev.mysql.com/doc/refman/5.6/en/ ... nnodb.html

or magic php scripts (source)

Code: Select all

<?php
    // connect your database here first 
    // 

    // Actual code starts here 

    $sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_SCHEMA = 'your_database_name' 
        AND ENGINE = 'MyISAM'";

    $rs = mysql_query($sql);

    while($row = mysql_fetch_array($rs))
    {
        $tbl = $row[0];
        $sql = "ALTER TABLE `$tbl` ENGINE=INNODB";
        mysql_query($sql);
    }
?>
Top

vestacp89
Posts: 83
Joined: Thu Aug 14, 2014 11:04 am

Re: from ''MyISAM'' to ''InnoDB'' and conversely
  • Quote

Post by vestacp89 » Sun Mar 15, 2015 9:39 am

skurudo wrote:mysql / phpmyadmin - http://dev.mysql.com/doc/refman/5.6/en/ ... nnodb.html

or magic php scripts (source)

Code: Select all

<?php
    // connect your database here first 
    // 

    // Actual code starts here 

    $sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_SCHEMA = 'your_database_name' 
        AND ENGINE = 'MyISAM'";

    $rs = mysql_query($sql);

    while($row = mysql_fetch_array($rs))
    {
        $tbl = $row[0];
        $sql = "ALTER TABLE `$tbl` ENGINE=INNODB";
        mysql_query($sql);
    }
?>
Hello,

this script:

Code: Select all

<?php
    // connect your database here first 
    // 

    // Actual code starts here 

    $sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_SCHEMA = 'your_database_name' 
        AND ENGINE = 'MyISAM'";

    $rs = mysql_query($sql);

    while($row = mysql_fetch_array($rs))
    {
        $tbl = $row[0];
        $sql = "ALTER TABLE `$tbl` ENGINE=INNODB";
        mysql_query($sql);
    }
?>
I need to paste this code make .php file and run ?
I don't know what all i need edit in this code,
can you pls tell what i need to edit in code, my database name is ''auto_db'' ?

Thanks.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: from ''MyISAM'' to ''InnoDB'' and conversely
  • Quote

Post by skurudo » Sun Mar 15, 2015 2:09 pm

Too many manuals in network, make backup and try:

https://gist.github.com/calevans/9943627

https://pantheon.io/blog/moving-mysql-t ... sam-innodb

http://www.woblag.com/2012/10/batch-con ... nnodb.html
Top


Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “Database Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password