1.查看当前数据引擎的命令: show engines; 2. USE `[DBNAME]`; SELECT GROUP_CONCAT(CONCAT( 'ALTER TABLE ' ,TABLE_NAME ,' ENGINE=InnoDB; ') SEPARATOR '' ) FROM information_schema.TABLES AS t WHERE TABLE_SCHEMA = '[DBNAME]' AND TABLE_TYPE = 'BASE TABLE'; 将其中的红色部分替换为你…
查看字段编码: show full columns from t2;show variables like '%character%';show variables like 'collation_%';show variables like 'character_set_%'; 修改库字符集: alter database test character set gbk; 修改表字符集: alter table t1 character set gbk; 修改字段字符集: alter table…
#!/bin/bash # 假设将sakila数据库名改为new_sakila # MyISAM直接更改数据库目录下的文件即可 mysql -uroot -p123456 -e 'create database if not exists new_sakila' list_table=$(mysql -uroot -p123456 -Nse "select table_name from information_schema.TABLES where TABLE_SCHEMA='sakila'&…