To automate the backup process, you can run it daily or hourly via the Schedule tab. If you later need to restore, run the following command: mysql -u yourusername -h 'yourusername$dbname' < db-backup.sqlīe aware that this will completely delete any existing data in the database though! Scheduling the backup as a task ¶ The db-backup.sql file will then be available in your home folder (via theįiles tab), where you can download it to a safe place. That's because your password is automatically saved by the pythonanywhere system to a file at ~/.my.cnf. You'll notice that we're not entering a password for the database. The 'single-quotes' around the database name are required, because of the '$' character in the full database name. Mysqldump -u yourusername -h -set-gtid-purged =OFF -no-tablespaces -column-statistics = 0 'yourusername$dbname' > db-backup.sql If you're doing the backup using MySQL Distrib 8.0, you may add -column-statistics=0 option as well: cd Mysqldump -u yourusername -h -set-gtid-purged =OFF -no-tablespaces 'yourusername$dbname' > db-backup.sql These usually follow the naming convention yourusername$dbname - so the full name includes your username, and the character "$"Īrmed with these two, you should open up a Bash console, and then run the following command: cd The full name of the database you want to back up. ![]() ![]() You can find this on the "Databases" tab, it's usually something like We'll need to arm ourselves with two pieces of information, both of which you can find on the Databases tab from your PythonAnywhere dashboard. To back up your MySQL database, you can use the mysqldump command-line tool.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |