문제

I am new to MySQL and know how to use mysqldump utility to backup a database. However, I think it is not installed on pythonanywhere. I would appreciate any suggestions on how I can back up mysql databases that I create on pythonanywhere.

Thank you.

도움이 되었습니까?

해결책

[update]

We've now made the mysqldump binary available via bash console sessions, so you can just go ahead and use it!

(historical answer follows for anyone curious / affected by a similar problem)

PythonAnywhere admin here, we'll try and include mysqldump asap.

In the meantime, maybe some kind of serialization could be the answer?

If you're using Django for example, you could use its ORM to convert each record to some kind of JSON or XML serialised representation, and dump them to a text file...

Django has an admin command you can use for that:

python manage.py dumpdata my_app > my_app_dump.json

more info here: https://docs.djangoproject.com/en/dev/ref/django-admin/#dumpdata-appname-appname-appname-model

If you're not using django, maybe something like SQLAlchemy could help? there's a few pointers here: How to serialize SqlAlchemy result to JSON?

Maybe we'll just hurry up and get mysqldump in!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top