IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Centos使用MySQL工具Percona Toolkit

    wwek发表于 2015-09-19 12:00:29
    love 0

    Centos使用MySQL工具Percona Toolkit

    安装Percona Toolkit 的Repo 得以支持直接用yum 安装二进制包

    yum install -y https://www.percona.com/redir/downloads/percona-release/redhat/latest/percona-release-0.1-3.noarch.rpm
    yum install -y percona-toolkit

    改MySQL表结构DDL pt-online-schema-change

    pt-online-schema-change -u root -h 10.8.8.8 -p password --alter='add column vid int ' --execute D=database,t=table

    D=database 库名
    t=table 表名
    –alter=’add column vid int ‘ 要执行的语句

    这里要说坑
    mysql版本5.5 数据库和表都是utf8编码,linux终端也是utf8编码
    执行 pt-online-schema-change 去给一个表加字段
    执行完毕后,发现这个表的字段 中文 注释 COMMENT 都乱码了!!
    有知道怎么解决的同学可以给我留下言

    Operation, tries, wait:
    copy_rows, 10, 0.25
    create_triggers, 10, 1
    drop_triggers, 10, 1
    swap_tables, 10, 1
    update_foreign_keys, 10, 1
    Altering `wwek`.`wwek_users`...
    Creating new table...
    Created new table wwek._wwek_users_new OK.
    Altering new table...
    Altered `wwek`.`_wwek_users_new` OK.
    2015-09-18T10:56:16 Creating triggers...
    2015-09-18T10:56:16 Created triggers OK.
    2015-09-18T10:56:16 Copying approximately 183066 rows...
    Copying `wwek`.`wwek_users`: 30% 01:10 remain
    Copying `wwek`.`wwek_users`: 49% 01:01 remain
    Copying `wwek`.`wwek_users`: 63% 00:51 remain
    Copying `wwek`.`wwek_users`: 76% 00:37 remain
    Copying `wwek`.`wwek_users`: 88% 00:20 remain
    2015-09-18T10:59:03 Copied rows OK.
    2015-09-18T10:59:03 Swapping tables...
    2015-09-18T10:59:03 Swapped original and new tables OK.
    2015-09-18T10:59:03 Dropping old table...
    2015-09-18T10:59:04 Dropped old table `wwek`.`_wwek_users_old` OK.
    2015-09-18T10:59:04 Dropping triggers...
    2015-09-18T10:59:04 Dropped triggers OK.
    Successfully altered `wwek`.`wwek_users`.

     

    文档&&参考

    官方文档Percona Toolkit Documentation

    猜您也喜欢:

    Centos上用YUM方式安装mysql衍生发行版Percona Server

    解决php通过localhost不能连接mysql数据库

    Linux CentOS centos5.4下载

    CentOS Linux安装Redmine项目管理系统(已有nginx,mysql环境)

    Linux下MySQL远程登录
    无觅


沪ICP备19023445号-2号
友情链接