mysql_convert_table_format 批量修改表引擎
[root@server-mysql bin]# mysql_convert_table_format --help Conversion of a MySQL tables to other storage engines Usage: /usr/bin/mysql_convert_table_format database [table[ table ...]]
1.If no tables has been specifed, all tables in the database will be converted.
2.You can also use wildcards, ie "my%" The following options are available: -f, --force
Continue even if there is some error. -?, --help
Shows this help -e, --engine=ENGINE
Converts tables to the given storage engine (Default: MYISAM) -h, --host=HOST
Host name where the database server is located. (Default: localhost) -p, --password=PASSWORD
Password for the current user. -P, --port=PORT
TCP/IP port to connect to if host is not "localhost". -S, --socket=SOCKET
Socket to connect with. -u, --user=USER
User name to log into the SQL server. -v, --verbose
This is a test specific option that is only used when debugging a test.
Print more information about what is going on. -V, --version
Shows the version of this program.
convert.sh
#!/bin/bash
/usr/local/mysql56/bin
echo 'Enter Host Name:'
read HOSTNAME
echo 'Enter User Name:'
read USERNAME
echo 'Enter Password:'
read PASSWD
echo 'Enter Socket Path:'
read SOCKETPATH
echo 'Enter Database Name:'
read DBNAME
echo 'Enter Table Name:'
read TBNAME
echo 'Enter Table Engine:'
read TBTYPE /usr/local/mysql56/bin/mysql_convert_table_format --host=$HOSTNAME --user=$USERNAME --password=$PASSWD --socket=$SOCKETPATH --type=$TBTYPE $DBNAME $TBNAME --verbose
mysql> select concat(table_schema,'.',table_name) as table_name ,engine from information_schema.tables where table_schema = 'test';
+------------+--------+
| table_name | engine |
+------------+--------+
| test.t | InnoDB |
| test.t1 | InnoDB |
| test.t3 | InnoDB |
| test.t4 | InnoDB |
| test.t5 | InnoDB |
+------------+--------+
5 rows in set (0.01 sec)
[root@server-mysql ~]# ./convert.sh
./convert.sh: line 3: /usr/local/mysql56/bin: is a directory
Enter Host Name:
localhost
Enter User Name:
root
Enter Password:
Aa@12345
Enter Socket Path:
/tmp/mysql.sock5
Enter Database Name:
test
Enter Table Name: Enter Table Engine:
MYISAM
Warning: /usr/local/mysql56/bin/mysql_convert_table_format is deprecated and will be removed in a future version.
Converting tables:
converting t
converting t1
converting t3
converting t4
converting t5
mysql> select concat(table_schema,'.',table_name) as table_name ,engine from information_schema.tables where table_schema = 'test';
+------------+--------+
| table_name | engine |
+------------+--------+
| test.t | MyISAM |
| test.t1 | MyISAM |
| test.t3 | MyISAM |
| test.t4 | MyISAM |
| test.t5 | MyISAM |
+------------+--------+
5 rows in set (0.01 sec)
mysql_convert_table_format 批量修改表引擎的更多相关文章
- mysql批量修改表引擎
生成修改的语句 SELECT CONCAT('ALTER TABLE ',table_name,' ENGINE=InnoDB;') FROM information_schema.tables WH ...
- innodb数据库批量转换表引擎为MyISAM
2013.0106 innodb数据库批量转换表引擎为MyISAM 来源:本站原创 PHP, 数据库, 系统技术 超过488名童鞋围观 1条评论 <?php //连接数据库 $host='lo ...
- Mysql MyISAM数据库批量转换表引擎为Innodb
Mysql MyISAM数据库批量转换表引擎为Innodb 最近在做事物处理需要把表结构都改为带有支持事物的Innodb引擎格式, 把里面数据库 用户名.密码 等信息修改为你自己的,放在网站下运行即可 ...
- mysql 修改表引擎方法
修改表引擎方法 方法1:修改mysql.ini配置文件,重启mysql服务生效 修改my.ini,在[mysqld]下加上default-storage-engine=INNODB 其中红色字体部分是 ...
- MYSQL批量修改表前缀与表名sql语句
修改表名 ALTER TABLE 原表名 RENAME TO 新表名; 一句SQL语句只能修改一张表 show tables; 1. SELECT CONCAT( 'ALTER TABLE ', ta ...
- SQL批量修改表名
SELECT NAME FROM SYS. ALL_OBJECTS WHERE TYPE= 'U' ORDER BY MODIFY_DATE DESC --查询所有表名 SELECT NAME FRO ...
- mysql修改表引擎Engine
修改my.ini,在[mysqld]下加上default-storage-engine=INNODB 其中红色字体部分是要指定的引擎名称.用sql语句修改已经建成表的引擎:alter table ta ...
- SQL SERVER批量修改表名前缀
比如前缀由mms_修改为 ets_ exec sp_msforeachtable @command1=' declare @o sysname,@n sysname ...
- SQL 批量修改表结构
项目中发现一批语言表的某个字段设的值太小了需要增大,因为涉及到很多张表,所以采用游标一张张的处理. 代码很简单 ) ) DECLARE LangTable CURSOR FOR SELECT name ...
随机推荐
- uva 11922 - Permutation Transformer
splay的题: 学习白书上和网上的代码敲的: #include <cstdio> #include <cstring> #include <cstdlib> #i ...
- Maven安装与更新
Maven是Apache组织中的一个颇为成功的开源项目,主要服务于基于Java平 台的项目构建.依赖管理和项目信息管理: 1) Maven是跨平台的,在Windows.Linux和Mac上都可以使用: ...
- POJ 2409 Let it Bead(Polya定理)
点我看题目 题意 :给你c种颜色的n个珠子,问你可以组成多少种形式. 思路 :polya定理的应用,与1286差不多一样,代码一改就可以交....POJ 1286题解 #include <std ...
- [topcoder]IncreasingSubsequences
http://community.topcoder.com/stat?c=problem_statement&pm=7753&rd=10672 http://community.top ...
- 码云分布式之 Brzo 服务器
摘要: 码云是国内最大的代码托管平台,为了支持更大的用户规模,开发团队也在对一些组件进行大规模的重构. 前言 码云是国内最大的代码托管平台.码云基于 Gitlab 5.5 开发,经过几年的开发已经和官 ...
- 【HDOJ】2209 翻纸牌游戏
状态压缩+双向广搜.注意控制时间t. /* 2209 */ #include <iostream> #include <string> #include <map> ...
- jackson 常见问题
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type org.codehaus ...
- Unity3D之Character Controller(CC)与GameObject的碰撞方法
先来一部分网上常见的内容(略整理): --------------------分隔线---------------------- Unity3d中参与碰撞的物体分2种类型: 一.发起碰撞的物体. 二. ...
- 只要把鼠标移上Div方框,方框就自动顺时针旋转
这是一个CSS3特效,IE下看不到效果.一个Div方框,在CSS3代码的作用下,只要把鼠标移上Div方框,方框就自动顺时针旋转.代码量不大,甚至有些简单,作为一个基础的CSS3实例,我想还是比较不错的 ...
- HDU 5938 Four Operations 【贪心】(2016年中国大学生程序设计竞赛(杭州))
Four Operations Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...