convert innodb to myisam

Started on the old forum in November 2014 · view the original in the archive · old links redirect here

2 replies · 89 views · started 12 years ago · 1 min read

2 participants
GumSlone Administrator Principal · 1,690 posts #1

login via ssh to your server create a file myisam.sh

nano myisam.sh

insert this 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

chmod 0775 myisam.sh

run it:

./myisam.sh
👍 1
Share

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

just_m3. Developer · 199 posts #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!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close