PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 25, 2022

[FIXED] Change storage engine from MyISAM to InnoDB - all tables at once - USING phpmyadmin

 January 25, 2022     innodb, myisam, phpmyadmin     No comments   

Issue

I have like 100 tables in mysql database and all are having storage engine: MyISAM. I want to change their storage engine all at once to innoDB and I DO NOT want to use:

1.PHP (How to convert all tables from MyISAM into InnoDB?

  1. Laravel(Laravel & InnoDB)

  2. One table at a time.(how to change storage engine of database in phpmyadmin?)

  3. SQL query .(How to change table storage engine from MyISAM to InnoDB)

  4. by xampp or similar way. (How to set the default storage engine to InnoDB in XAMPP )

So I want to change : ALL TABLE STORAGE ENGINE AT ONCE and using phpmyadmin interface.

Any help?


Solution

Will 2 steps suffice?

(1) Run the SELECT against information_schema, as seen in some of those links. But have it output 100 fully-formed ALTER statements.

SELECT CONCAT("ALTER TABLE ", table_name, " ENGINE=InnoDB;
")
    FROM information_schema.tables
    WHERE engine='MyISAM'
      AND table_schema='MyDatabase'
      AND ...;

(2) Copy and paste the 100 lines into phpadmin. Go have a coffee. Or spend the time reading about the gotchas in converting to see if you will have some issues.

Doing them truly in parallel is unlikely to be any faster -- you will be I/O bound. And the small tables will finish fast, leaving the big tables to stretch out the time anyway.

Output sample:

SELECT CONCAT("ALTER TABLE ", table_name, " ENGINE=InnoDB;
")
    FROM information_schema.tables
    WHERE engine='MyISAM'
      AND table_schema='test';

produces something like:

ALTER TABLE 07 ENGINE=InnoDB;\n
ALTER TABLE 597377b ENGINE=InnoDB;\n
ALTER TABLE adjprice ENGINE=InnoDB;\n
ALTER TABLE big ENGINE=InnoDB;\n
ALTER TABLE bigv ENGINE=InnoDB;\n
ALTER TABLE blobid ENGINE=InnoDB;\n
ALTER TABLE charlatin1 ENGINE=InnoDB;\n
ALTER TABLE collorder ENGINE=InnoDB;\n
ALTER TABLE collorder2 ENGINE=InnoDB;\n
ALTER TABLE countries ENGINE=InnoDB;\n
ALTER TABLE d1 ENGINE=InnoDB;\n

Then paste however many rows are generated back into the tool. No need to manually type the names.

If you first convert 100 tables, they will not be included when you run the query again. Only the new 25 will be included.

No, you cannot "automatically" change any new tables to a different engine. However...

By saying this in my.cnf, you can have all new table for which you do not explicitly specify an ENGINE be InnoDB:

[mysqld]
default_storage_engine = InnoDB


Answered By - Rick James
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing