zoukankan      html  css  js  c++  java
  • linux 批量重命名文件

    1. 分隔

     >>split -l 5 data_out.sql test

    2.重命名

    >>for j in test*; do mv -v -- "$j" "$j.sql";done

    To export

    If it's an entire DB, then:

    $ mysqldump -u [uname] -p[pass] db_name > db_backup.sql

    If it's all DBs, then:

    $ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql

    If it's specific tables within a DB, then:

    $ mysqldump -u [uname] -p[pass] db_name table1 table2 > table_backup.sql

    You can even go as far as auto-compressing the output using gzip (if your DB is very big):

    $ mysqldump -u [uname] -p[pass] db_name | gzip > db_backup.sql.gz

    If you want to do this remotely and you have the access to the server in question, then the following would work (presuming the MySQL server is on port 3306):

    $ mysqldump -P 3306 -h [ip_address] -u [uname] -p[pass] db_name > db_backup.sql

    To import

    Type the following command to import sql data file:

    $ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql

    In this example, import 'data.sql' file into 'blog' database using Sathish as username:

    $ mysql -u sat -p -h localhost blog < data.sql

    If you have a dedicated database server, replace localhost hostname with with actual server name or IP address as follows:

    $ mysql -u username -p -h 202.54.1.10 databasename < data.sql

    OR use hostname such as mysql.cyberciti.biz

    $ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql

    If you do not know the database name or database name is included in sql dump you can try out something as follows:

    $ mysql -u username -p -h 202.54.1.10 < data.sql

    Refer: http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

    If you want a GUI tool then you could probably use SQLyog

    参考文献:

    http://stackoverflow.com/questions/11407349/mysql-how-to-export-and-import-an-sql-file-from-command-line

  • 相关阅读:
    ab并发负载压力测试
    在vmware里运行qcow2镜像
    nginx root alias
    速成制作rpm包
    oracle分区表按时间自动创建
    Some network Tools
    python中defaultdict用法详解
    CENTOS7 安装telnet
    H3C 交换机配置
    H3C
  • 原文地址:https://www.cnblogs.com/davidwang456/p/4912225.html
Copyright © 2011-2022 走看看