Import MySQL Database using Command Line: VPS BIBLE




new password?
login
X

Reinstate MySQL DBs with Terminal Shell

import db image

This guide provides the syntax for uploading data to a MySQL database. For instance, you’ve changed Linux server, have added a blank database and now want to add your previously backed up data.

Just replace the db name, username & password and paste the code into your terminal.

Sure, you could use a client like phpMyAdmin, but this is faster.

Setup Unmanaged VPS: The Ubuntu-Nginx Guide

Take your virtual private server from zero to hero

  .. from blank box to cute-as server ..  

with this easy-to-follow copy/paste guide.

22+ parts with video, here’s the index.

Log into the terminal and type:-


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

You’ll be prompted for your db password. Once entered, hey presto.

MySQL Backup Syntax Broken Down

  • -u tells mysql we’re about to name the user
  • user is the database username
  • -p tells mysql to prompt us for the database user’s password
  • database is the name of your database
  • < tells mysql the backup is to be appended to the database
  • path/to/database.sql is the complete path to the backup file

So, if I’ve got a database called “work”, my username is “guv”, my password is “abc”, my backup db is called “backup.sql” and located in a backup folder “/home/user/dbBackup/”, I could use something like this, below. (The one possible variable is the name of the backup file, which I can call whatever I like) ..


Please sign up for automatic premium content access.

Just $15/year* will save you hours, maybe days!

Alternatively, the vpsBible forum is free and you are welcome.

Prompted, after inputting the password, the import is facilitated and that’s that.

Setup Unmanaged VPS: The Ubuntu-Nginx Guide

Take your virtual private server from zero to hero

with this easy-to-follow copy/paste guide.

“My local PC runs Windows” Show me for Linux

22+ parts with video, here’s the index ..

Manage Unmanaged VPS: Ubuntu-Nginx Administration

Already set it up? We’d best maintain it then.

Toggle to the ..  Ubuntu-Nginx Admin Index

Manage Unmanaged VPS: Ubuntu-Nginx Administration

Maintain your virtual private server with ..

.. cheatsheets, tutorials, tips & guides.

Head back to the ..  Ubuntu-Nginx Installation Index

Nginx Admin: In the Works ..

This lot’s marked for addition already:-

  • Setup or Edit DNS using Bind
  • Network Tools Troubleshooting Guide
  • The Comprehensive Permissions Guide
  • Configuring Nginx Rewrites
  • Custom Website Error Page
  • Setting up Cron Jobs
  • Rsync for Incremental Remote-to-Local Backup
  • Cron & Rsync for Automatic Backup
  • Cron & mysqldump for Auto DB Backup
  • Safeguard Bandwidth with Hotlink Protection
  • Block Access with Nginx’ IP Deny



Got a Question? Want to Comment?

This site has no comments system. We've got a better system!

Please use the link at the top of the post and goto this topic's forum thread:-

  • to help build community
  • for a superior knowledge base
  • to keep info in one place, not diluted between forum & comments.

For those posts ported from Guvnr.com (pre-Feb/2010), archive comments remain.

Handy info from these comments is in the process of being ported to the forum and attributed to the original author.

If you think this idea sucks, let me know.

Thank you.