convert innodb to myisam

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    convert innodb to myisam

    login via ssh to your server
    create a file myisam.sh
    Code:
    nano myisam.sh
    insert this code:
    Code:
    #!/bin/bash
    
    MYSQLCMD=mysql
    
    for db in `echo show databases | $MYSQLCMD | grep -v Database`; do
            for table in `echo show tables | $MYSQLCMD $db | grep -v Tables_in_`; do
                    TABLE_TYPE=`echo show create table $table | $MYSQLCMD $db | sed -e's/.*ENGINE=\([[:alnum:]\]\+\)[[:space:]].*/\1/'|grep -v 'Create Table'`
                    if [ $TABLE_TYPE = "InnoDB" ] ; then
                            mysqldump $db $table > $db.$table.sql
                            echo "ALTER TABLE $table ENGINE = MyISAM" | $MYSQLCMD $db
                    fi
            done
    done
    chmod the myisam.sh
    Code:
    chmod 0775 myisam.sh
    run it:
    Code:
    ./myisam.sh
    Advertise your mobile site for FREE with AdTwirl


    #2
    How about login on database before executing the loop on myisam.sh ??
    i get error since i'm not loged in on a specific database , the code would not execute.

    This is ten percent luck, twenty percent skill
    Fifteen percent concentrated power of will
    Five percent pleasure, fifty percent pain

    And a hundred percent reason to remember the name!

    Comment


      #3
      it works for me when i login as a root user to my server
      Advertise your mobile site for FREE with AdTwirl

      Comment

      Working...
      X