MySQL
Occasionally I have found a need to connect to certain MySQL tables or Databases remotely. Obviously such a connection presents a security risk and generally it is best to restrict remote users to a specific ip address. This can be done with a firewall rule and/or MySQL provides a way to restrict the user by host. This is how I set up a remote MySQL user. login to your mysql and issue the following command:
SSH into your server if you are working remotely. Create an empty database
mysql -u username -p -e 'CREATE DATABASE database
Now use the following command from your ssh session
mysql -u username -p database < path/to/backup.sql
Backing-up your sql databases can be done effectively with the mysqldump facility. You will need to login as the MySQL server root administrator. The following command will backup ALL your databases.
mysqldump -u myusername -pmypassword -A > backup.sql
To dump a single database
mysqldump -u myusername -pmypassword databasename > backup.sql
