Forums

Export mysql 8 db from my PC and import to Pythonanywhere

What is the exact procedure? Do I have to export db using what utility from my local PC? And in the dashboard of pythonanyqhere what can I have to do? Create the same db empty and after importing? Can I have any clarifications? Thank you

You can use the mysqldump command on your local machine to create a file that contains the SQL statements to create your tables and populate them with the appropriate data. Once you've done that, you can upload the file to PythonAnywhere and create the database from the "Databases" page, then use the mysql command from a bash console to load it; that last command will look something like this

mysql -u andfae -h andfae.mysql.pythonanywhere-services.com -p 'andfae$yourdatabasename' < yourmysqlfile.sql

...where yourdatabasename will be the database name you used when creating the database, and yourmysqlfile.sql is the name of the file you uploaded. The single quotes around the database name are important -- they stop Bash from interpreting the $ as an indication of an environment variable to expand.

We are now able to migrate users to MySQL 8 on request. The migration takes a few minutes plus the time it takes for us to dump and reload your databases on the new server. So larger databases will take longer. Your database will not be available during the migration. You will need to be on either the glastonbury or the haggis system image (https://help.pythonanywhere.com/pages/ChangingSystemImage/), so please make sure that you are on one of those before making the request. Send a request to support@pythonanywhere.com with an indication of a time when it will be convenient for you (between 11am and 6pm UTC on a weekday).