Code: Select all
ERROR 1215 (HY000) at line 2: Cannot add foreign key constraint
My parent database was users. I had previous issued the following command to look at its schema:
Code: Select all
show create table users
Code: Select all
alter table users InnoDB
---
Incidentally, here is a query you can use that will tell you all of the tables (from all non-system databases) that are not using InnoDB, and which will format that output into a series of commands that can be used to change those tables:
Code: Select all
SELECT CONCAT('ALTER TABLE `', table_schema, '`.`', table_name, '` ENGINE=InnoDB;') AS sql_statements FROM information_schema.tables WHERE table_schema NOT IN ('information_schema', 'performance_schema', 'mysql') AND engine = 'MyISAM' AND table_type = 'BASE TABLE' ORDER BY table_schema,table_name;
Code: Select all
mysql -u root -p -e "source /path/to/query" > /path/to/update
mysql -u root -p -e "/path/to/update"