PythonAnywhere上如何备份MySQL数据库

3

我是MySQL的新手,知道如何使用mysqldump实用程序备份数据库。但是,我认为它未安装在PythonAnywhere上。请给出任何建议,以便我可以备份在PythonAnywhere上创建的mysql数据库。

谢谢。

1个回答

6

[更新]

我们现在已经通过bash控制台会话提供了mysqldump二进制文件,所以您可以直接使用它!

(对于任何好奇或受类似问题影响的人,以下是历史回答)

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!


谢谢。如果您能尽快获取mysqldump,我将不胜感激。我没有使用Django。这不是为Web应用程序。 - Curious2learn
1
它运行得非常好。我对你们的安装速度感到惊讶。Pythonanywhere团队非常棒,很愉快能与他们合作。 - Curious2learn
1
现在如果我们能安装PostgreSQL就好了... :) - a2j

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接