• mysql这个垃圾迁移数据费劲半天


    垃圾得很! 便宜就好货吗? 对于一些小系统还可以。大型系统自己找麻烦--必须有高昂的人工费!

    去除oracle,真好吗?

    对于dba而言非常麻烦,尤其是迁移数据的时候!

    --

    它让我们非常想念oracle.

    有一个要求,要传输20万数据。

    用了source,一定也不好用! 各种设置还是和蜗牛差不多!

    于是只好采用 select into + load data的方式

    (版本 8.0.x)

    不过在执行前,得先设置

    secure_file_priv=''

    这样设置的意思是,可以指定任意目录。

    如果不再my.cnf等配置参数指定,则默认是NULL,表示不可以导出导入。

    secure_file_priv得官方解释是:

    The secure_file_priv system variable limits import and export operations to a specific
    directory. Create a directory whose location can be specified as the value of that variable:
    mkdir mysql-files
    Grant directory user and group ownership to the mysql user and mysql group, and set the
    directory permissions appropriately:
    chown mysql:mysql mysql-files
    chmod 750 mysql-files

     

     

    这个参数的作用类似于oracle的directory概念,不过oracle这个值是非常灵活的。

    配置好之后:

    源库:

    SELECT * INTO OUTFILE  'datadumpdata.txt' FIELDS TERMINATED BY ',' FROM c117_scores;

    目标库:

    LOAD DATA INFILE 'e:\temp\data.txt' INTO TABLE c117_scores FIELDS TERMINATED BY ',';

    速度是快了不少!

    --

    所以迁移几个表的时候得准备一套脚本,否则让您够受得!

    导入几张表的数据,在开发和维护中是很常见的!

    可以考虑开发一个小工具用于迁移!不过好像navicate有类似功能!

    但依然不够好用,这种专业工具最好稍微配置下,可以批处理执行!

  • 相关阅读:
    Tinkoff Challenge
    Tinkoff Challenge
    Tinkoff Challenge
    Tinkoff Challenge
    整体二分
    树链剖分+LCT
    上下界网络流
    莫队
    可并堆
    bzoj_1033: [ZJOI2008]杀蚂蚁antbuster
  • 原文地址:https://www.cnblogs.com/lzfhope/p/14587416.html
Copyright © 2020-2023  润新知