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 ...
随机推荐
- css3媒体查询判断移动设备横竖屏
/* 设备竖屏时调用该段css代码 */ @media all and (orientation : portrait){ body{ background-color:blue; } } /* ...
- Android之单复选框及Spinner实现二级联动
一.基础学习 1.图形学真的很神奇啊....查了些资料做出了3D云标签,哈哈...其实直接拿来用的,我们要效仿鲁迅先生的拿来主义,嘿嘿~~3D标签云就是做一个球面,然后再球面上取均匀分布的点,把点坐标 ...
- js 正则 非负整数
Javascript 正则表达式 非负整数 /** * 正则判断非负整数 */ function testnum(ob){ var reg=/^[0-9]+?$/; //如果正则需要判断非负整数并带2 ...
- 修改sphinx最大输出记录数
修改sphinx最大输出记录数 归纳如下: Sphinx的查询默认最大记录数是:1000,而我们想更改这个数值.就需要更改三个地方. 1是更改sphinx.conf配置文件的:max_matches ...
- Win7系统Matlab2013a安装.m文件不自动关联到MATLAB.exe解决方法
1.在matlab命令行中输入以下代码: cwd=pwd; cd([matlabroot '\toolbox\matlab\winfun\private']); fileassoc('add',{'. ...
- 如何使用 HTTP 响应头字段来提高 Web 安全性?
在 Web 服务器做出响应时,为了提高安全性,在 HTTP 响应头中可以使用的各种响应头字段. X-Frame-Options 该响应头中用于控制是否在浏览器中显示 frame 或 iframe 中指 ...
- OA学习笔记-004-Spring2.5配置
一.jar包 (1)spring.jar (2)Aop包 aspectjrt.jaraspectjweaver.jar (3)动态代理 cglib-nodep-2.1_3.jar (4)日志 comm ...
- php获取html checkbox的值。
一个小错误,搞了好久: <label><input class="short" type="checkbox" id="is_onl ...
- “面包屑导航”——SiteMapPath控件的使用(ASP.NET)(转)
转自:http://www.cnblogs.com/ball-head/archive/2010/09/28/1837253.html 最近在博客里写了一些日志,主要都是我在实际编程过程中遇到的问题. ...
- ASPNET5中的那些K
ASPNET5中的那些K ASP.NET 5最大的变化是什么?首当其冲的就是多了很多K,K表示的是ASP.NET vNext的项目代号“Project K”,但很容易让人想到一个汉字——“坑”,希望K ...