Reputation: 173
I am new to MySQL. I need to take a backup of a database in MySQL. So I have written a query as:
mysqldump -u root -p pwd123 r_mysql > BackupHRM2.sql
For this I am getting an error saying
#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 -u root -p pwd123 r_mysql > BackupHRM2.sql' at line 1
Please could someone help me to overcome this problem?
Upvotes: 2
Views: 2692
Reputation: 55856
use
mysqldump -u root -ppwd123 r_mysql > BackupHRM2.sql
see there is no gap between -p
and PASSWORD
If you are using PHPMyAdmin, backup from "Export" tab.
I am not very familiar with PHPMyAdmin, to import your backed up database just execute this from your command prompt (or Shell/Console).
mysql -u USERNAME -pPASSWORD DBNAME < path/to/BackupHRM2.sql
Upvotes: 1
Reputation: 206679
mysqldump
is a command line utility. You are supposed to run it directly from your shell, not inside a mysql
session. It's not an SQL command.
If you're using phpMyAdmin, look for backup options there. (Look at How to backup your Mysql database with phpMyAdmin for instance.)
Upvotes: 4