在MariaDB上使用PyMySQL [英] Using PyMySQL with MariaDB
问题描述
我已阅读这篇文章关于从在Ubuntu上将MySQL转换为MariaDB.该文章声称,在两者之间进行切换不是问题.
I have read this article about switching from MySQL to MariaDB on Ubuntu. The article claims that it would be not problem to switch between the two.
当前,我正在使用 PyMySQL 连接到我的MySQL数据库,并从其中插入,更新和删除值它.
Currently, I am using PyMySQL to connect to my MySQL database and insert, update and delete values from it.
我的问题是:我可以只升级到MariaDB并继续使用我的Python代码吗? PyMySQL是否也可以正确连接到MariaDB?
My question is: can I just upgrade to MariaDB and keep on using my Python code? Will PyMySQL also connect correctly to MariaDB?
推荐答案
MariaDB是MySQL的二进制替代版本
出于所有实际目的,MariaDB是替代同一MySQL版本(例如MySQL 5.1-> MariaDB 5.2 和 MariaDB 5.3 兼容.MySQL5.5是与 MariaDB 5.5 兼容,并且在实践中还与
MariaDB is a binary drop in replacement for MySQL
For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version (for example MySQL 5.1 -> MariaDB 5.1, MariaDB 5.2 & MariaDB 5.3 are compatible. MySQL 5.5 is compatible with MariaDB 5.5 and also in practice with MariaDB 10.0). What this means is that:
- 数据和表定义文件(.frm)文件是二进制兼容的.
- 请参见下面的注释,以免与视图不兼容!
- Data and table definition files (.frm) files are binary compatible.
- See note below for an incompatibility with views!
- PHP5存在一些安装问题意识到(旧的PHP5客户端如何检查库兼容性的错误).
- There are some installation issues with PHP5 that you should be aware of (a bug in how the old PHP5 client checks library compatibility).
这意味着在大多数情况下,您只需卸载MySQL并安装MariaDB ,一切顺利. (如果使用相同的主版本,例如5.1,则无需转换任何数据文件).但是,您仍然必须运行
mysql_upgrade
以完成升级.这是确保MariaDB使用的新字段来更新您的mysql特权和事件表的必要条件.This means that for most cases, you can just uninstall MySQL and install MariaDB and you are good to go. (No need to convert any datafiles if you use same main version, like 5.1). You must however still run
mysql_upgrade
to finish the upgrade. This is needed to ensure that your mysql privilege and event tables are updated with the new fields MariaDB uses.本文继续列出了一些较小的不兼容之处,您应该检查这些不兼容之处.
The article goes on to list a few minor incompatibilities, which you should check your application(s) do not rely upon.
这篇关于在MariaDB上使用PyMySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!