/go/myisam2innodb: myisam2innodb from the Command Line

/go/myisam2innodb changes the storage engine of MariaDB tables from MyISAM to InnoDB. InnoDB is the default engine in current MariaDB and supports transactions, row-level locking, foreign keys, and crash recovery. The command works in three modes: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Convert all MyISAM tables in one database (you will be asked for the MariaDB root password)
/go/myisam2innodb shop_db

Arguments

Position Name Required Notes
1 <database> or all Yes A database name, or the word all for every database.
2 <table> No A table in that database. If given, only this table is converted, whatever its engine.

The command has no --option flags.

Examples

# Convert all MyISAM tables in one database
/go/myisam2innodb shop_db

# Convert one table
/go/myisam2innodb shop_db orders

# Convert every database on the server
/go/myisam2innodb all

# Check the engines afterwards
mariadb -e "SELECT table_name, engine FROM information_schema.tables WHERE table_schema='shop_db';"

Output

The command prints progress text. Errors come directly from MariaDB.

Message Meaning
Converting Database <database> to InnoDB... all mode: the start of one database, between two lines of dashes.
Converting Table '<table>' to InnoDB... A table is being converted.
(nothing) The database has no MyISAM tables, or the table list could not be read.

There is no summary at the end. Every call is also appended to /var/log/go/myisam2innodb.log.

Exit codes

Situation Exit code
No arguments 1, no message
all Always 1, even when every conversion succeeded
One database or one table The status of the last step

Do not rely on the exit code in all mode.

See the full reference at /go/myisam2innodb and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *