1
BACKUP DATABASE dbwebsite TO DISK 'C:\Users\Paeng\Desktop\mydatabase.sql';

It always says error

Query : BACKUP DATABASE dbwebsite TO DISK 'C:\Users\Paeng\Desktop\mydatabase.sql'
Error Code : 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 'DATABASE dbwebsite TO DISK 'C:\Users\Paeng\Desktop\mydatabase.sql'' at line 1

3

1 Answer 1

1

To the best of my knowledge there is no SQL Statement for MySQL database to backup anymore like the syntax you are using and which is possible for MS SQL Server via TSQL.
For MySQL you have the following options to backup your database:

  1. Use mysqldump as a logical backup tool
  2. Use MySQL Enterprise Backup if you have MySQL Enterprise Edition.
  3. You can copy the MyISAM tables by just copying them.
  4. You could also write a SQL script and copy the content of the tables into txt files by using the command: SELECT * INTO OUTFILE 'fileName' FROM tableName
  5. You could of course also use replication or file system snapshots.
  6. If you want to backup the database using vb.net (as mentioned in comments), you can use the following MySqlBackup.NET, which is an alternative to mysqldump. The web site and documentation can be found here: https://github.com/MySqlBackupNET/MySqlBackup.Net

For more info read the MySQL documentation: here.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, #4 perfectly work but i need to backup database using query or using vb.net platform

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.