亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Verzeichnis suchen
前言 MySQL的使用 MySQL多表同時刪除方案 MySQL跨表、多表更新SQL語句總結(jié) MySQL存儲引擎 安裝 常規(guī)方式編譯安裝MySQL 采用cmake方式編譯安裝MySQL 使用rpm包安裝MySQL 使用yum方式安裝MySQL 采用二進制方式免編譯安裝MySQL 多實例的安裝 什么是多實例 多實例的作用、問題以及應(yīng)用場景 多實例安裝01【推薦】 多實例官方安裝方案02 啟動、用戶和權(quán)限管理 單實例MySQL的啟動和關(guān)閉的方法 設(shè)置及修改MySQL root用戶密碼 找回丟失的MySQL root用戶密碼 創(chuàng)建MySQL用戶及用戶權(quán)限管理 基礎(chǔ)命令的操作 MySQL庫和表相關(guān)操作 MySQL中的索引操作 MySQL常用命令 MySQL的錯誤代碼 MySQL復習秘籍 備份與恢復 備份 恢復 mysqlbinlog命令 服務(wù)日志 主從復制 主從復制部署配置問題匯總 主從復制讀寫分離 災難恢復 配置phpmyadmin連接多實例MySQL MySQL語句大全 用戶創(chuàng)建、權(quán)限、刪除 數(shù)據(jù)庫與表顯示、創(chuàng)建、刪除 Mysql表復制及備份還原 數(shù)據(jù)庫表中數(shù)據(jù)操作 修改表中的指定一條數(shù)據(jù) 查詢表 日志 批量修改Mysql表引擎為InnoDB的方法 數(shù)據(jù)庫抽象層 PDO PDO對象常用方法 PDO 事務(wù)處理 PDO 與 MySQLi 二者效率簡單比較 大小寫敏感性 lower_case_table_names CentOS7安裝MySQL5.7密碼查看與修改
Figuren

一般批量修改MYSQL中某表的數(shù)據(jù)庫引擎可以利用官方工具mysql_convert_table_format來實現(xiàn), 這里指的是不使用其他工具僅用shell的方法來實現(xiàn)。(以下例子效果是將數(shù)據(jù)庫shop中所有引擎不為InnoDB的表修改為使用InnoDB引擎)[ 查看表引擎的語句:show create table tableName; ],其實核心關(guān)鍵點是這條語句:

alert table tableName engine=innodb;

下面開始修改:

備份數(shù)據(jù)庫

在命令行下運行得到備份SQL

mysqldump -uroot -p******** shop > shop20160505.sql

在命令行建立一個測試數(shù)據(jù)庫并導入SQL

mysql -uroot -p******** -e 'create database shop_to_innodb charset utf8';
mysql -uroot -p******** shop_to_innodb < shop20160505.sql

shell獲取需要更換表引擎

mysql -uroot -p******** -e "show table status from shop_to_innodb where Engine <> 'InnoDB' \G"|grep Name|awk '{print "alter table "$2" engine=innodb;";}' > mysql_change_to_innodb.txt

上面的語句在命令行中執(zhí)行得到 mysql_change_to_innodb.txt 文件(包含了shop_to_innodb庫中所有引擎不為InnoDB的改變語句)。

查看導出的修改語句

使用vim命令或者cat命令查看 mysql_change_to_innodb.txt 文件,檢查是否為自己要修改的內(nèi)容。

alter table a engine=innodb;
alter table b engine=innodb;
alter table category engine=innodb;
alter table ecs_account_log engine=innodb;
alter table ecs_ad engine=innodb;
alter table ecs_ad_custom engine=innodb;
alter table ecs_ad_position engine=innodb;
alter table ecs_admin_action engine=innodb;
alter table ecs_admin_log engine=innodb;
alter table ecs_admin_message engine=innodb;
alter table ecs_admin_user engine=innodb;
alter table ecs_adsense engine=innodb;
alter table ecs_affiliate_log engine=innodb;
alter table ecs_agency engine=innodb;
alter table ecs_area_region engine=innodb;
alter table ecs_article engine=innodb;
alter table ecs_article_cat engine=innodb;
alter table ecs_attribute engine=innodb;
alter table ecs_auction_log engine=innodb;
alter table ecs_auto_manage engine=innodb;
alter table ecs_back_goods engine=innodb;
alter table ecs_back_order engine=innodb;
alter table ecs_bonus_type engine=innodb;
alter table ecs_booking_goods engine=innodb;
alter table ecs_brand engine=innodb;
alter table ecs_card engine=innodb;
alter table ecs_cart engine=innodb;
... ...

執(zhí)行修改語句

如果沒用問題我們可以接著執(zhí)行下面的語句。

mysql -uroot -p******** shop_to_innodb < mysql_change_to_innodb.txt

如果數(shù)據(jù)庫非常大可能要等一段時間


Vorheriger Artikel: N?chster Artikel: