• mysqldump command description:
    • --add-drop-table: add a statement to delete database data table before each create statement
    • --add-locks: lock the database table when the backup database tables
    • --all-databases: mysql backup of all databases on the server
    • --comments: add annotations
    • --compact: compressed mode produces less output
    • --complete-insert: complete insert statement output
    • --databases: Specifies the database to be backed up
    • --default-character-set: Specifies the default character set
    • --force: when an error occurs backup operation continues
    • --host: Specifies the backup server database
    • --lock-tables: Before making backup, lock all database tables
    • --no-create-db: create database statement to disable the generation
    • --no-create-info: disable the generation of database creation statements
    • --pasword: connect mysql server password
    • --port: mysql server port number
    • --user: user name connected to mysql server
  • Look at these headaches, directly on the bar code:
    • 1. single database backup information:
      mysqldump -u username -p password --databases database> / save path / filename .sql
    • for example:
        • Backup data database, the user name is root, password is root, the backup file to the current folder 1.sql:
      mysqldump -uroot -proot  --databases data >1.sql
    • Note: The backup time there will be a prompt:
      Warning: Using a password on the command line interface can be insecure.

      Can be ignored. Explained as follows: WARNING: potentially unsafe password on the command-line interface.

    • 2. Back up all database information:
      mysqldump -u username -p password --all-databases> / save path / filename .sql
    • for example:
        • All backup database, the user name is root, password is root, the backup file to the current folder 1.sql:
      mysqldump -uroot -proot --all-databases >1.sql
    • 3. one backup data table:
      mysqldump -u username -p password database name watches> Export file name
    • for example:
        • Backup all data in the database users table, the username is root, password is root, the backup file to the current folder 3.sql:
      mysqldump -uroot -proot data users >3.sql
  • We will be backed up, definitely need to restore the database following recovery code is:
    • 1. Direct File Recovery
      mysql-u username -p password database name <database file
    • for example:
        • Ss import node.sql database to database, the user name root, root password
      mysql -uroot -proot ss < node.sql
    • 2. source into the database
      After login to the database through the mysql command, execute: source path / filename .sql
    • for example:
        • Ss import node.sql database to database, the user name root, root password
       mysql -uroot -proot
       use ss
       mysql>source node.sql