Skip to content

Instantly share code, notes, and snippets.

@nvanselow
Last active October 1, 2017 13:55
Show Gist options
  • Save nvanselow/23d28a3737e85110c420 to your computer and use it in GitHub Desktop.
Save nvanselow/23d28a3737e85110c420 to your computer and use it in GitHub Desktop.
Transferring a MySql database

Warning: Doing the following will overwrite your database.

The following will allow you to use a sql dump to overwrite an existing database.

  1. If the file is gzipped, run gunzip name_of_file.sql.gz
  2. Copy the file to the server
  3. Replace the database with the sql dump. mysql -uusername –p database_name < file.sql
  4. On Laravel Homestead, this would be mysql -uhomestead -p homestead < file.sql

Or this if the above is outputting a bunch of help text: cat file.sql | mysql database_name -uusername -p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment