Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2549303
  • 博文数量: 271
  • 博客积分: 6659
  • 博客等级: 准将
  • 技术积分: 3141
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-17 10:24
文章分类

全部博文(271)

文章存档

2016年(2)

2015年(12)

2014年(7)

2013年(19)

2012年(22)

2011年(81)

2010年(128)

分类: Mysql/postgreSQL

2011-11-04 17:23:45

mysql> select version();
+------------+
| version()  |
+------------+
| 5.5.16-log |
+------------+
1 row in set (0.00 sec)

mysql> show engines;
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                    | Transactions | XA   | Savepoints |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| MyISAM             | YES     | MyISAM storage engine                                      | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                             | NULL         | NULL | NULL       |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                         | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                         | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                      | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables  | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
7 rows in set (0.00 sec)

 ::export
 mysqldump  --opt -R -uroot -pxxxxxx info_account > info_account.sql
 
 //-R, --routines      Dump stored routines (functions and procedures).
 
 ::importing
 mysql -uroot -pxxxxxx info_account < info_account.sql
 
 修改表引擎语句
ALTER TABLE tablename ENGINE = INNODB;

设置本地密码xxxxxx
[root@bogon mysql]# mysqladmin -uroot -p password xxxxxx
Enter password: 

批量修改表引擎
[root@bogon mysql]# vim change-engines.sh
  1. #!/bin/bash
  2. #write by H
  3. declare -a database
  4. database=(info_account info_game)
  5. password='xxxxxx'
  6. for db in ${database[@]}
  7.         do
  8.         #echo "DATABASE=$db"
  9.         tables=`mysql -uroot -p$password -e "use $db;show tables;" | sed 1d`
  10.         for table in $tables
  11.                 do
  12.                 echo "TABLE=$db.$table"
  13.                 mysql -uroot -p$password -e "alter table $db.$table engine=INNODB;"
  14.                 sleep 0.2
  15.         done
  16. done
阅读(1296) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~