I tried to backup the database from my mysql server.
I am using MYSQL 5.5.
I used the following Command to backup the database.
$
try with this in command prompt not in mysql prompt
mysqldump -u root -p admin project > projectbackup.sql
Docs
From what I remember, mysqldump is a program, not a MySQL command. Run it from the Windows command prompt instead of the MySQL prompt. Also, don't include the $ dollar sign.
Also you'll need to include the username and password with --user=Your_user_name_here --password=Your_password_here
Documented usage here: http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html
To backup my DB, I use these three commands (in a batch file):
mysqladmin -u root -pMyPassword drop backupExample --force=true
mysqladmin -u root -pMyPassword create backupExample
mysqldump -h 127.0.0.1 -u root -pMyPassword DBExample | mysql -h 127.0.0.1 -u root -pMyPassword backupExample
where:
"DBExample" is the name of the DB to backup
"backupExample" is the new db that will be created as a copy
"MyPassword" is your db password
Hope it helps!
The mysqldump command accesses a program and is not called in the mysql command prompt.
It basically does a big SELECT * FROM tables...
query and echos the output in your terminal, which is why you redirect the output to save it to a file.
You need to find the direct path to the mysqldump.exe
file and then execute it that way.
C:\...\path\to\mysql\bin\mysqldump.exe -uroot -p DATABASE_SCHEMA > C:\backup.txt
Only include the -p
flag if your mysql root user account has a password and replace the DATABASE_SCHEMA
text with what your database name is called.
Try this mysqldump -uroot -p project > projectbackup.sql
.
Now when prompted for password type "admin"
Open up a Windows command prompt.
Click Start -> Run
Enter “cmd” into the dialog box and click the “OK” button.
Change the directory to the following to access the mysqldump utility.
cd C:\Program Files\MySQL\MySQL Server 5.5\bin
Create a dump of your current mysql database or table (do not include the bracket symbols [ ] in your commands).
Run the mysqldump.exe program using the following arguments:
mysqldump.exe –e –u[username] -p[password] -h[hostname] [database name] > C:\[filename].sql