IT/Software/Database Applications/mysql command line/mysqldump: Difference between revisions
Access restrictions were established for this page. If you see this message, you have no access to this page.
(added note) |
No edit summary |
||
Line 15: | Line 15: | ||
mysqldump --verbose -u<localDbUser> -p<localDbPassord> <localDbName> > /tmp/<dbName>.sql && cat /tmp/<dbname>.sql | ssh user@remote.host mysql -u<remoteDbUser> -p'<remoteDbPassword>' <remoteDbName> | mysqldump --verbose -u<localDbUser> -p<localDbPassord> <localDbName> > /tmp/<dbName>.sql && cat /tmp/<dbname>.sql | ssh user@remote.host mysql -u<remoteDbUser> -p'<remoteDbPassword>' <remoteDbName> | ||
Note: The above should work without issue but has not undergone much testing yet. | Note: The above should work without issue but has not undergone much testing yet. | ||
Note2: When running a dump using the above method the remote database differed in files size from the source by about 20-30M on a 100M database. |
Revision as of 17:45, 6 February 2020
Options
- You can do this from phpMyAdmin or other gui based apps.
- See the Applications page for this.
- You can perform the dump to various resources.
- Dump to a text file.
- Dump to a zipped file
- Dump to another database
- Dump to another Database on another server
Dumping To a Remote Host
When running a mysql dump to a remote host directly over ssh the host database will be locked until the sync has finished. (Can be up to 5-10 minutes for lager databases)
The above problem can be easily circumvented by dumping to a file and than cating the file into ssh to the remote host as such.
mysqldump --verbose -u<localDbUser> -p<localDbPassord> <localDbName> > /tmp/<dbName>.sql && cat /tmp/<dbname>.sql | ssh user@remote.host mysql -u<remoteDbUser> -p'<remoteDbPassword>' <remoteDbName>
Note: The above should work without issue but has not undergone much testing yet.
Note2: When running a dump using the above method the remote database differed in files size from the source by about 20-30M on a 100M database.