Example:Code language: SQL (Structured Query Language) (sql)mysqldump –-user [user name] –-password=[password] [database name] > [dump file] or mysqldump –u[user name] –p[password] [database name] > [dump file]
Code language: SQL (Structured Query Language) (sql)mysqldump –-user root –-password=myrootpassword db_test > db_test.sql or mysqldump –uroot –pmyrootpassword db_test > db_test.sql
Example:Code language: SQL (Structured Query Language) (sql)mysqldump –u[user name] –p[password] [database name 1] [database name 2] .. > [dump file]
Code language: SQL (Structured Query Language) (sql)mysqldump –-user root –-password=myrootpassword db_test db_second db_third > db_test.sql
Code language: SQL (Structured Query Language) (sql)shell> mysqldump –u[user name] –p[password] –all-databases > [dump file]
shell> mysqldump --user [username] --password=[password] [database name] [table name] \
> /tmp/sugarcrm_accounts_contacts.sql
Code language: SQL (Structured Query Language) (sql)
Example: shell> mysqldump --user root --password=myrootpassword db_test customers \
> db_test_customers.sql
Code language: SQL (Structured Query Language) (sql)
shell> mysql –u [username] –password=[password] [database name]Code language: SQL (Structured Query Language) (sql)
Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
Hi
I need examples to take database backup from online server.
I worked your examples query but it was not working.
i am using MySql. In MySql i use test database i need how to take backup in local folders
and how to run the restore database.
There was a problem like this error occur : "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqldump –-user root password = root db_test > db_test.sql' at line 1 "
Thank you
S.Gopalakrishnan
Email : gsskkrish@yahoo.co.in
@S.Gopala krishnan
try this:
mysqldump -u root -psecret db_test > db_test.sql
Please tell me how to restore MySql database file using java class. I have written a code but it cant restore here is the code:
[code]
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
public class restoreDB extends JPanel {
public restoreDB() {
myRestore();
}
public void myRestore() {
File file=null;
JFileChooser filechooser=new JFileChooser();
int selection=filechooser.showOpenDialog(new MainWindow());
if(selection==JFileChooser.APPROVE_OPTION) {
file=filechooser.getSelectedFile();
String r=file.getAbsolutePath();
String s=r.replace('\\', '/');
// String s=r.replaceAll(" ", "\" \"");
// String[] executeCmd = new String[]{"C:/Program Files/MySQL/MySQL Server 6.0/bin/mysql", "userlogin", "--user=root" , "--password=root", "-e", s };
System.out.println(s);
try {
// Process runtimeProcess =Runtime.getRuntime().exec(executeCmd);
Process p=Runtime.getRuntime().exec("C:/Program Files/MySQL/MySQL Server 6.0/"+
"bin/mysql -u root -proot < "+s);
}catch(Exception e) {
System.out.println(e);
}
}
}
}
[/code]
please give me an example.
to back up all databases use --all-databases, not -all-databases. At least in my browser that's how the code appears from this page (as an en-dash maybe?).
I think this blog forces two hyphens to become an en-dash.
to back up all databases use - - all-databases (two hyphens), not -all-databases (one hyphen). At least in my browser that’s how the code appears from this page.
Hi Viral,
Thnks for your article.
I want to share something.
We can also take Dump only rows selected by the given WHERE condition.
shell> mysqldump --user [username] --password=[password] [database name] [table name] where = "[condition]"\ > /tmp/sugarcrm_accounts_contacts.sql
Example:
shell> mysqldump --user root --password=myrootpassword db_test customers where = " id='15' " \ > db_test_customers.sql
@Niraj: Thanks for sharing that snippet. Definitely useful to many of us.
Good work. Much appreciated :)
Thank you for Backup all databases in MySQL command
You should take a look at this instead:
https://sourceforge.net/projects/automysqlbackup/
I just installed it and it works as a charm :D , Just what I was looking for!
This script is even in the ubuntu repositories! Just use:
apt-get install automysqlbackup
hi..
i took mysql database backup in windows server and i restored that mysql db in linux pc.. its sucessfully restored ..i connected that mysql db in client xp mechine ..i compiled that db procedure but its show tables doesn't exit..will u pls tel how to solve this problem
Restoring a dump table into the MySQL master server can lead to serious replication delay.
To overcome the replication delay, caused by restoring the dump table on the master, there is a need to widespread the massive inserts. This can be done by the MySQL SLEEP command.
See As restoring a dump table into the MySQL master – you better get some sleep