Is there a command in terminal for finding out what storage engine my MySQL database is using?
Issue the SHOW ENGINES statement to view the available MySQL storage engines. Look for DEFAULT in the SUPPORT column. mysql> SHOW ENGINES; Alternatively, query the INFORMATION_SCHEMA.
Simply check the value of the Engine column in the returned dataset to know which engine the table is using. Show activity on this post. SELECT ENGINE FROM INFORMATION_SCHEMA. TABLES WHERE TABLE_NAME='your_table_name' AND TABLE_SCHEMA='your_database_name'; -- or use TABLE_SCHEMA=DATABASE() if you have a default one.
mysql> show databases; Here is the output that displays all the databases. As you can see above, we have both databases, and we can get the current database name with the help of DATABASE() method.
Add default-storage-engine=InnoDB in [mysqld] section of the my. cnf file for the default engine to be active. Use the 'show create table table_name' command to view default engine in the table.
This is available in a few places.
SHOW CREATE TABLE
output.mysql> SHOW CREATE TABLE guestbook.Guestbook;
+-----------+-------------------------------------------+
| Table | Create Table |
+-----------+-------------------------------------------+
| Guestbook | CREATE TABLE `Guestbook` (
`NAME` varchar(128) NOT NULL DEFAULT '',
`MESSAGE` text NOT NULL,
`TIMESTAMP` varchar(24) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-----------+-------------------------------------------+
1 row in set (0.00 sec)
You may also find it in information_schema.TABLES
if you want to query the engines of multiple tables.
SELECT ENGINE
FROM information_schema.TABLES
WHERE
TABLE_NAME='yourtable'
AND TABLE_SCHEMA='yourdatabase';
SHOW ENGINES;
return the engines your MySQL database support and tell you which is the default one if not otherwise specified at creation time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With