|
/Hosting/NearlyFreeSpeech:
MySQL For NearlyFreeSpeech.net Power Users
To get a MySQL command line:
mysql --user=your-user-name --host=your-database-name.db
And yes you can automatically back up you MySQL database, by yourself, for free. There are just a couple hoops to jump through.
First set up SSH passwordless authentication as described here[1], with the modification that you cannot install the public key yourself on the NearlyFreeSpeech.net end. You must send them a "Support Request" (click on the Support tab after logging in) with the public key, and they will register it within a few hours[2].
Their FAQ kind of tip toes around the issue without giving a clear answer: [3][4][5]. The member wiki has the real solution[6]. Create a /home/private/.my.cnf file in your nearlyfreespeech.net account:
[client]
host = put_your_DSN_here
user = put_your_username_here
password = put_your_password_here
Then on the machine where you want to store the database backup (your desktop?) execute the following:
ssh johndoe_thesite@ssh.phx.nearlyfreespeech.net 'mysqldump thedatabase | bzip2 -9' > ~/backups/thedatabase_backup-`date +%Y-%m-%d`.sql.bz2
Note that "mysqldump" is found in the "mysql-client" package, at least in Debian. And of course, to automate, stick the above in your crontab ("crontab -e").
(Note: replace "user" below with your nearlyfreespeech.net username.)
[1] http://blog.langex.net/index.cgi/Admin/SSH-SSL/passwordless-ssh-authentication.html
[2] https://members.nearlyfreespeech.net/user/support/faq?q=SSHKeys#SSHKeys
[3] https://members.nearlyfreespeech.net/user/support/faq?q=MySQLForward#MySQLForward
[4] https://members.nearlyfreespeech.net/user/support/faq?q=MySQLLocalhost#MySQLLocalhost
[5] https://members.nearlyfreespeech.net/user/support/faq?q=MySQLCommandLine#MySQLCommandLine
[6] https://members.nearlyfreespeech.net/wiki/HowTo/DatabaseBackup
posted at: 14:58 | path: /Hosting/NearlyFreeSpeech | permanent link to this entry