Guide | Dorsum Upward Together With Restore Mysql Database Via Crunch Ascendency Line

Guide | Back Up And Restore MySQL Database Via Shell Command Line.

Back Up MySQL database. To give-up the ghost along your SQL database relieve yous must regularly dorsum upward it at every fourth dimension yous can. Anything tin hap on your calculator at whatever time, for example, your computer's difficult drive could damage, virus or põrnikas assault your file together with program, or stolen past times someone, which it causes your database loses or broken. To dorsum upward the MySQL database is easy. We tin relieve the MySQL database to flash drive or local drive together with then restore to the other computers. All pace on this direct using a crunch dominance line, thus yous must write downwards every dominance starting fourth dimension earlier performing dorsum upward together with restore MySQL databases. You must hold upward careful inwards guild to write dominance hither to avoid fault syntax.

Now, allow nosotros start out our direct to Back Up And Restore MySQL Database Via Shell Command Line. We use mysqldump command to exercise text file dumps of databases managed past times MySQL

Back Up MySQL Database.

  1. Open XAMPP Control panel.
  2. Then click Shell.
  3. Don't brand whatever connectedness to your SQL server.
  4. For this case, nosotros convey created MySQL database on this guide, this database called customers.
     Back Up And Restore MySQL Database Via Shell Command Line Guide | Back Up And Restore MySQL Database Via Shell Command Line
    mySQL database
  5. Now type the next dominance at crunch prompt;
    • mysqldump -uroot database name
  6. Example ;
    • mysqldump -uroot customers
  7. Then press larn inwards push your keyboard.
  8. The result must provide amongst this.
     Back Up And Restore MySQL Database Via Shell Command Line Guide | Back Up And Restore MySQL Database Via Shell Command Line
    back upward MySQL database
  9. This result alone dorsum upward MySQL database on crunch dominance line. So how to post your database into SQL text file? right away follow the adjacent step.

Send the MySQL database into SQL text file.

Once your database successfully backup, right away it's fourth dimension to exercise SQL dump text file. So, yous tin movement your SQL database to the other computer.
  1. Create a folder on a specific drive on your computer.
  2. For example, nosotros would similar to exercise a information folder at drive E:\ so the result volition hold off similar this.
    • E:\data
  3. Then type the next dominance at crunch prompt;
    • mysqldump -uroot database name >D:\folder\file name.sql
  4. Example;
    • mysqldump -uroot customers >E:\data\customers2.sql
  5. Then press enter, hither yous volition meet nix at crunch dominance prompt.
  6. Now, larn to drive E:\data
  7. There yous should meet customers2.sql dump text file.
     Back Up And Restore MySQL Database Via Shell Command Line Guide | Back Up And Restore MySQL Database Via Shell Command Line
    SQL dump text file
  8. Finish, right away yous tin movement this SQL file to the other calculator together with restore it to available MySQL database

Restore MySQL database.

  1. Once your SQL text file inwards hand, right away yous tin movement to the other SQL server. or yous tin restore it to the same server.
  2. Open XAMPP Control panel.
  3. Then click Shell.
  4. Connect to SQL server, type the next dominance ;
    • mysql -uroot
  5. Now exercise a novel database, for example, type the next dominance ;
    •  create database customers2;
  6. Then develop active this novel database, type the next dominance ;
    • use customers2;
  7. Now restore customers2.sql text file to customers2 database. type the next command
    • the syntax is : source E:\\folder\\file name.sql
  8. Therefore yous should type 
    •  source E:\\data\\customers2.sql
  9. If your database successfully restored your dominance prompt should hold off similar this.
     Back Up And Restore MySQL Database Via Shell Command Line Guide | Back Up And Restore MySQL Database Via Shell Command Line
    restore MySQL database - inquiry ok
  10. Now yous tin cheque whether the database has been successfully restored to MySQL. type the next dominance ;
    • show databases;
  11. And yous should your novel database there.
     Back Up And Restore MySQL Database Via Shell Command Line Guide | Back Up And Restore MySQL Database Via Shell Command Line
    restore mySQL database
  12. Also, yous tin cheque all available tabular array on this database. type the next dominance ;
    • show tables;
  13. Finish, congratulations yous convey successfully dorsum upward together with restore your SQL database