I can’t back up the mysql database using the dump

Asked

Viewed 2,229 times

0

I have some questions. I need to make a copy of a database that is not on my machine, but on a server.. I am using the mysql dump command, but when I type the following command

mysqldump -u user -password&1234 database > .sql file

, it returns that what is from the "&", is not valid..

thus:

"1234 is not recognized as an internal or external command or a operable program or batch file".

that "&" in the password cannot exist? ...

one more thing, before using this command I need to connect to the right bank?

prompt> mysql [-h hostname or ip] [-u user_name] [-psua_password]

I use this command?..

grateful at once.

  • The dump runs directly on the console. And the problem is not in the dump, but in the absence of escaping the special characters. If it’s linux, try one before the &

  • Utilize Toad for Mysql (http://www.toadworld.com/m/freeware/1469) is very useful for maintenance work, backing up is very practical.

2 answers

2


Robson, open your command prompt and navigate to the folder where your executable is mysqldump, probably in the folder bin mysqlserver.

Example:

cd\
cd "C:\Program Files\MySQL\MySQL Server 5.5\bin"

Run the mysqldump command to perform the backup:

mysqldump -h ip_servidor -p porta_servidor -u usuario -p senha_usuario nome_banco > backup.sql

You do not need the '&' in the password, unless your password is composed by it.

Replace 'ip_server' with the corresponding address of your server, as well as the fields 'porta_server', 'user', 'senha_user' and name_database.

  • thanks friend, it worked.

  • I’m glad it worked Robson, please select as response so other users also see.

0

If you’re on the same machine as the bank:

mysqldump -uUser -pSenha DataBase > c:\seu_backup.sql

If you are on another machine (that has mysql installed) and are on the same network as the database:

mysqldump -uUser -pSenha -hIp_do_Banco DataBase > c:\seu_backup.sql

Note: Windows OS

Browser other questions tagged

You are not signed in. Login or sign up in order to post.