国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

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

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

alert table tableName engine=innodb;

下面開(kāi)始修改:

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

在命令行下運(yùn)行得到備份SQL

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

在命令行建立一個(gè)測(cè)試數(shù)據(jù)庫(kù)并導(dǎo)入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

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

查看導(dǎo)出的修改語(yǔ)句

使用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í)行修改語(yǔ)句

如果沒(méi)用問(wèn)題我們可以接著執(zhí)行下面的語(yǔ)句。

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

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


Previous article: Next article: