MySQL as a Form of Torture

I’ve spent all morning trying out different MySQL database commands to restore a .sql file (database backup file) on a server through SSH.  Just as I was about to give up I got the right sequence of letters and numbers to appease the angry monster.

(this is more for my future benefit than anything else)

mysql -u (MySQL username) -p (Database Name) < (name of the text or sql file)

  • I have to write the username after -u BUT I don’t write the password after -p.
  • The “<” points to the direction of the action.  So the sql file restores to the database.

Example:

mysql -u clay -p mydatabase < backup.sql 

I read a lot of blogs, tutorials and MySQL manuals today and tried mysqldump, mysqlimport and just about every other sensible sounding command.  I finally tried the simple ‘mysql.’

If you know your way around MySQL, you may be saying ‘duh,’ but by posting it here, I will be sure to remember it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s