Guide Back Up And Restore MySQL Database Via Shell Command Line.
Back Up MySQL database. To preserve your SQL database save you should regularly again up it at on every occasion you could. Anything can occur in your pc at any time, as an example, your pc's difficult pressure ought to damage, virus or malicious program attack your file and application, or stolen with the aid of a person, which it reasons your database loses or damaged. To back up the MySQL database is straightforward. We can shop the MySQL database to flash pressure or neighborhood force then repair to the opposite computer systems. All step on this guide the use of a shell command line, so that you should write down each command first earlier than appearing again up and restore MySQL databases. You need to be careful so one can write command here to avoid blunders syntax.
Now, allow we begin our guide to Back Up And Restore MySQL Database Via Shell Command Line. We use mysqldump command to create text document dumps of databases managed through MySQL
Back Up MySQL Database.
- Open XAMPP Control panel.
- Then click Shell.
- Don't make any connection to your SQL server.
- For this case, we've created MySQL database on this guide, this database referred to as customers.mySQL database
- Now type the following command at shell spark off;
- mysqldump -uroot database name
Example ;
- mysqldump -uroot customers
Then press enter button your keyboard.the result ought to return with this.
|
back up MySQL database |
This result best returned up MySQL database on shell command line. So the way to ship your database into SQL text file? Now follow the following step.
Send the MySQL database into SQL text file.
Once your database correctly backup, now it's time to create SQL unload text record. So, you may move your SQL database to the alternative pc.
- Create a folder on a specific force to your computer.
- For instance, we would really like to create a statistics folder at force E: so the result will appear like this.
Then type the subsequent command at shell spark off;
- mysqldump -uroot database name >D:folderfile call.sql
Example;
- mysqldump -uroot customers >E:data\customers2.sql
Then press input, right here you will see not anything at shell command spark off.now, go to pressure
E:dataThere you have to see
customers2.sql sell off text report.
|
SQL dump text file |
Finish, now you may move this SQL record to the opposite computer and restore it to available MySQL database
Restore MySQL database.
- Once your SQL text record in hand, now you may pass to the other SQL server. Or you can repair it to the equal server.
- Open XAMPP Control panel.
- Then click on Shell.
- Connect to SQL server, type the following command ;
Now create a brand new database, for instance, kind the following command ;
- create database customers2;
Then set lively this new database, kind the subsequent command ;
Now repair
customers2.sql text document to
customers2 database. type the subsequent command
- the syntax is : source E:\folder\\file name.sql
Therefore you have to type
- source E:data\\customers2.sql
If your database efficiently restored your command activate need to seem like this.
|
restore MySQL database - question ok |
Now you could take a look at whether or not the database has been efficiently restored to MySQL. Kind the following command ;
And you ought to your new database there.
|
restore mySQL database |
Also, you could check all to be had desk in this database. Kind the subsequent command ;
Finish, congratulations you have got effectively lower back up and repair your SQL database
0 comments:
Post a Comment