• linux下mysql的备份和还原


    1.备份:

    [root@localhost ~]# mysqldump -u root -p test>/opt/test.sql
    Enter password: 

    使用mysqldump备份, 并将备份文件指向输出目录, 输入密码即可

    2.还原:

    先创建要还原的数据库

    [root@localhost ~]# mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 8
    Server version: 5.0.45 Source distribution
    
    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema | 
    | mysql              | 
    +--------------------+
    2 rows in set (0.00 sec)
    
    mysql> create database test;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> exit
    Bye

    指向备份文件进行还原

    [root@localhost ~]# mysql -u root -p test</opt/test.sql 
    Enter password:
  • 相关阅读:
    Docker5之Deploy your app
    Docker4之Stack
    Docker3之Swarm
    Docker之Swarm
    Docker2之Service
    Docker1之Container
    Nuget EPPlus的使用
    Nuget CsvHelper 的使用
    excel
    Chrome上的扩展工具
  • 原文地址:https://www.cnblogs.com/leaf1117/p/3466945.html
Copyright © 2020-2023  润新知