- Uncaught Exception: DB Error: Access denied for user ” (using password: YES)
= Check credentials
by dev
by dev
Purpose:
To solve the error “General error: 1005 Can’t create table ` `.`review_round_files` (errno: 150 “Foreign key constraint is incorrectly formed”)”
We will convert MySQL tables from MyISAM into InnoDB in two different ways.
PhpMyAdmin
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME,' ENGINE=InnoDB;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'DBNAME' AND ENGINE = 'MyISAM' AND TABLE_TYPE = 'BASE TABLE'
ALTER TABLE DBNAME.access_keys ENGINE=InnoDB; ALTER TABLE DBNAME.announcement_settings ENGINE=InnoDB; ALTER TABLE DBNAME.announcement_type_settings ENGINE=InnoDB; ALTER TABLE DBNAME.announcement_types ENGINE=InnoDB; ALTER TABLE DBNAME.announcements ENGINE=InnoDB; ALTER TABLE DBNAME.article_event_log ENGINE=InnoDB; ALTER TABLE DBNAME.auth_sources ENGINE=InnoDB;
SSH Method
mysql -u root -p
SELECT CONCAT('ALTER TABLE ',TABLE_NAME,' ENGINE=InnoDB;') FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND table_schema = 'yourdb';
Replace yourdb to your database name. And the conversion commands will be used later.
use yourdb
ALTER TABLE pln_deposit_objects ENGINE=InnoDB; ALTER TABLE issues ENGINE=InnoDB; ALTER TABLE custom_section_orders ENGINE=InnoDB; ALTER TABLE access_keys ENGINE=InnoDB; ALTER TABLE journals ENGINE=InnoDB; ALTER TABLE notification_subscription_settings ENGINE=InnoDB; ALTER TABLE notifications ENGINE=InnoDB; ALTER TABLE review_object_types ENGINE=InnoDB; ALTER TABLE filter_settings ENGINE=InnoDB; ALTER TABLE users ENGINE=InnoDB;
That’s all.
Related scripts you may need.
Convert all DBNAME’s InnoDB Tables to MyISAM
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME,' ENGINE=MyISAM;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'DBNAME' AND ENGINE = 'InnoDB' AND TABLE_TYPE = 'BASE TABLE'
Convert all DBNAME’s MyISAM Tables to InnoDB
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME,' ENGINE=InnoDB;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'DBNAME' AND ENGINE = 'MyISAM' AND TABLE_TYPE = 'BASE TABLE'
Convert all InnoDB Tables to MyISAM (all databases)
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ' engine=MyISAM;') FROM information_schema.TABLES WHERE ENGINE = 'InnoDB';
Convert all MyISAM Tables to InnoDB (all databases)
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ' engine=InnoDB;') FROM information_schema.TABLES WHERE ENGINE = 'MyISAM';