Search
 
SCRIPT & CODE EXAMPLE
 

SQL

convert all tables in database to from myisam to innodb

SET @DATABASE_NAME = 'name_of_your_db';

SELECT  CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM    information_schema.tables AS tb
WHERE   table_schema = @DATABASE_NAME
AND     `ENGINE` = 'MyISAM'
AND     `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;
Comment

Convert MyISAM Tables To InnoDB

## Convert ALL MyISAM tables in ALL databases to InnoDB
# This command will continue even if an individual table fails to convert.
# output is saved to convert-to-innodb.log
mysql -Bse 'SELECT CONCAT("ALTER TABLE ",table_schema,".",table_name," ENGINE=InnoDB;") FROM information_schema.tables WHERE table_schema NOT IN ("mysql","information_schema","performance_schema") AND Engine = "MyISAM";' | while read -r i; do echo $i; mysql -e "$i"; done | tee convert-to-innodb.log
Comment

Convert All InnoDB Tables To MyISAM

## Convert ALL InnoDB tables in ALL databases to MyISAM
# This command will continue even if an individual table fails to convert.
# output is saved to convert-to-myisam.log
mysql -Bse 'SELECT CONCAT("ALTER TABLE ",table_schema,".",table_name," ENGINE=MyISAM;") FROM information_schema.tables WHERE table_schema NOT IN ("mysql","information_schema","performance_schema") AND Engine = "InnoDB";' | while read -r i; do echo $i; mysql -e "$i"; done | tee convert-to-myisam.log
Comment

PREVIOUS NEXT
Code Example
Sql :: sqlite higher or equal 
Sql :: oracle all columns 
Sql :: homebrew mysql service not starting 
Sql :: sql primary key 
Sql :: How to create a comulative Sum column in mysql 
Sql :: mysql uuid 
Sql :: postgresql populate data random 
Sql :: sql select where id not exists in another table 
Sql :: keep getting an error when I try to connect to mysql workbench 
Sql :: mysql dump structure only 
Sql :: identify rows with 2 same column value and delete duplicate mysql 
Sql :: grapgql 
Sql :: update sql 
Sql :: sql constraint to check date less than current date 
Sql :: Oracle cx_Oracle example 
Sql :: select top values sql 
Sql :: sql select maximum column with other columns returned 
Sql :: how to switch database in psql 
Sql :: sql developer connect to sql server 
Sql :: what is table in sql 
Sql :: sql change primary key to composite key 
Sql :: sql ssrs 
Sql :: while mysql 
Sql :: json object to column value in sql server 
Sql :: like in sql 
Sql :: create table if not exist 
Sql :: Example SQL Test 
Sql :: jsonb 
Sql :: dynamic soql escape the single quote 
Sql :: knex last insert id mysql 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =