Forums

Export Import Datebase

Noob question, I'm sure :(

I want to export a database from my PA account and import it into another PA users account.

I found this, http://www.sudobash.net/mysql-easy-exportimport/ but not 100% sure on how to use this? Or is there another way I should be doing it?

I could obviously script it with Python but that seems like a faff.

Thanks for any help.

Hi there,

You would do something like

mysqldump -u graingerkid -h mysql.server -p 'graingerkid$default' > backup.sql

The key here is that you want to make sure the quotes around graingerkid$default is single quote, because otherwise bash thinks $default is a variable and tries to expand it.

After you generate the backup, if it is a huge file, you may want to use sftp/rsync etc to move it across. See here for more details.

You legend!

Hi there, I've never used command line for a database before, I tried that command with my own username and database name, then hit enter. I only got a new line with ->

Do you have any detailed instructions for someone who's new to this? Also, how do I access the backup.sql file? Thanks!

Are you trying to run that in a MySQL console instead of a Bash console? It needs to be run from a Bash console.

That makes sense now, I successfully made the backup and downloaded it from file manager. Thanks Glenn!

Glad we could help!