ALTER TABLE Persons ADD PRIMARY KEY (ID);
ALTER TABLE Persons ADD CONSTRAINT PK_Person PRIMARY KEY (ID, LastName);
ALTER TABLE <table_name> ENGINE=InnoDB;
SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME,
DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA;
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_COLLATION FROM
information_schema.TABLES WHERE TABLE_COLLATION IS NOT NULL ORDER BY
TABLE_SCHEMA, TABLE_COLLATION;
SELECT @@GLOBAL.character_set_server;
SELECT @@GLOBAL.collation_server;
ALTER DATABASE <db-name> COLLATE=<collation-name>;
ALTER TABLE <table-name> COLLATE=<collation-name>;
SELECT SCHEMA_NAME,DEFAULT_CHARACTER_SET_NAME,
DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA;
SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, CHARACTER_SET_NAME
FROM information_schema.COLUMNS WHERE CHARACTER_SET_NAME is not NULL
ORDER BY TABLE_SCHEMA, CHARACTER_SET_NAME;
SELECT @@GLOBAL.character_set_server;
SELECT @@GLOBAL.collation_server;
show create table <table name>;
CREATE TABLE `<table name>` (
`word` varchar(50) NOT NULL DEFAULT '',
`sid` int(10) unsigned NOT NULL DEFAULT '0',
`langcode` varchar(12) CHARACTER SET ascii NOT NULL DEFAULT '',
`type` varchar(64) CHARACTER SET ascii NOT NULL,
`score` float DEFAULT NULL,
PRIMARY KEY (`word`,`sid`,`langcode`,`type`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
ALTER TABLE <table-name> MODIFY `type` varchar(64) CHARACTER SET utf8mb4 NOT NULL;
ALTER TABLE <db>.<table> MODIFY COLUMN id bigint unsigned NOT NULL
AUTO_INCREMENT;
SHOW CREATE TABLE <db>.<table>;
ALTER TABLE <db>.<table> DROP CONSTRAINT <constraint fk name>;
SELECT CONCAT(object_schema, '.', object_name) AS 'table', index_name
FROM performance_schema.table_io_waits_summary_by_index_usage
WHERE index_name IS NOT NULL
AND count_star = 0
AND index_name <> 'PRIMARY'
AND object_schema NOT IN ('mysql', 'performance_schema', 'information_schema')
ORDER BY count_star, object_schema, object_name;
ALTER TABLE <table_name> ALTER INDEX <index_name> INVISIBLE;
ALTER TABLE <table_name> DROP INDEX <index_name>;
ALTER TABLE <table_name> ALTER INDEX <index_name> VISIBLE;