MySQL Commands You Should Have Committed to Memory Already

Posted by Trey on January 16, 2008

Dump the database

mysqldump -h database_host -uUsername -p database_name > dump.sql 

Restore from the dump

If you need to create the database first:

mysqladmin -h database_host -uUsername -p create database_name

Then load the SQL file:

mysql -h database_host -uUsername -p database_name < dump.sql

Source

Build Your Own Database Driven Website Using PHP & MySQL, 2nd Edition (Page 133)

Using SSH Keys for Password-Free Logins from OS X

Posted by Trey on January 11, 2008

If your remote username is different from your OS X username, edit your ~/.ssh/config file like so:

Host whathaveyou.com
    User remote_username

Generating your keys

On your OS X machine, enter this command:

ssh-keygen -t dsa

Enter a password or don’t (I didn’t).

This creates a public (~/.ssh/id_dsa.pub) and private key (~/.ssh/id_dsa).

Copying the public key to the remote server

Log in to the server with ssh (with your password–for the last time).

However you want to do it, open the file ~/.ssh/authorized_keys on the remote server and paste in the contents of id_dsa.pub. Alternately, you could use scp like so:

scp ~/.ssh/id_rsa.pub remote_username@whathaveyou.com:~/.ssh/authorized_keys

(Naturally, if the file and/or folder aren’t there, you’ll have to create them first.)

Now change the permissions:

chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys

All done. The next time you want to ssh to the server, it won’t prompt you for a password.

Sources: