« Importing files in SAS | Main | Create random number string in SAS »

January 15, 2013

Copy and import a mySQL database

This is the original source.

Createa backup of the database:
$ sudo mysqldump -u [dbUserName] --password=[dbUserPword] [dbName] | mysql -u [dbUserName] --password=[dbUserPword] -h localhost [dbName]

Create backup with compression:
$ mysqldump --opt -u [user] -p [dbase] | gzip -9 > output_file.sql.gz


The first part dumps database 1 and the second part imports the dump into database 2.

Notes on connecting to mySQL via command line:

$ mysql -u [dbuser] -h [dbhost] -p

mysql>

Import a database:

$ mysql -u [dbuser] -p -h [dbhost] [dbname] < [db_toimport.sql]

SFTP into a machine through a non-standard port

$ sftp -oPort=[port] [username]@[host]


Posted by kkwaiser at January 15, 2013 04:37 PM

Comments

Login to leave a comment. Create a new account.