Velmurugan
Velmurugan

Reputation: 2303

MySQL backup database

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.

            $ mysqldump -root -admin project > projectbackup.sql

My username: root, Password : admin, database name : project

But it showing the following error. as like as the following screenshot.

enter image description here

Upvotes: 2

Views: 9519

Answers (8)

FRITZ F
FRITZ F

Reputation: 101

$ mysqldump -uroot -padmin project > project.sql

Upvotes: 0

Niente0
Niente0

Reputation: 21

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!

Upvotes: 2

ar.gorgin
ar.gorgin

Reputation: 5002

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

Upvotes: 2

thar45
thar45

Reputation: 3560

try with this in command prompt not in mysql prompt

 mysqldump -u root -p admin project > projectbackup.sql

Docs

Upvotes: 9

matsko
matsko

Reputation: 22183

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.

Upvotes: 0

Subin Sebastian
Subin Sebastian

Reputation: 10997

Try this mysqldump -uroot -p project > projectbackup.sql.

Now when prompted for password type "admin"

Upvotes: 4

austin
austin

Reputation: 5866

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

Upvotes: 5

Anurag Kapur
Anurag Kapur

Reputation: 675

Unable to comment on the answer by @Thanga so posting it separately.

There should be a space between -u and root. Likewise for -p and admin. So the command would look like:

mysqldump -u root -p admin project

Upvotes: 0

Related Questions