将 PyMySQL 与 MariaDB 一起使用
Using PyMySQL with MariaDB
我已阅读 this article 关于在 Ubuntu 上从 MySQL 切换到 MariaDB 的内容。文章声称在两者之间切换不会有问题。
目前,我正在使用 PyMySQL 连接到我的 MySQL 数据库并从中插入、更新和删除值。
我的问题是:我可以升级到 MariaDB 并继续使用我的 Python 代码吗? PyMySQL 也能正确连接到 MariaDB 吗?
如 MariaDB versus MySQL - Compatibility 中所述:
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:
- Data and table definition files (.frm) files are binary compatible.
- See note below for an incompatibility with views!
- All client APIs, protocols and structs are identical.
- All filenames, binaries, paths, ports, sockets, and etc... should be the same.
- All MySQL connectors (PHP, Perl, Python, Java, .NET, MyODBC, Ruby, MySQL C connector etc) work unchanged with MariaDB.
- There are some installation issues with PHP5 that you should be aware of (a bug in how the old PHP5 client checks library compatibility).
- The
mysql-client
package also works with MariaDB server.
- The shared client library is binary compatible with MySQL's client library.
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.
本文接着列出了一些次要的不兼容性,您应该检查您的应用程序是否不依赖这些问题。
我已阅读 this article 关于在 Ubuntu 上从 MySQL 切换到 MariaDB 的内容。文章声称在两者之间切换不会有问题。
目前,我正在使用 PyMySQL 连接到我的 MySQL 数据库并从中插入、更新和删除值。
我的问题是:我可以升级到 MariaDB 并继续使用我的 Python 代码吗? PyMySQL 也能正确连接到 MariaDB 吗?
如 MariaDB versus MySQL - Compatibility 中所述:
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:
- Data and table definition files (.frm) files are binary compatible.
- See note below for an incompatibility with views!
- All client APIs, protocols and structs are identical.
- All filenames, binaries, paths, ports, sockets, and etc... should be the same.
- All MySQL connectors (PHP, Perl, Python, Java, .NET, MyODBC, Ruby, MySQL C connector etc) work unchanged with MariaDB.
- There are some installation issues with PHP5 that you should be aware of (a bug in how the old PHP5 client checks library compatibility).
- The
mysql-client
package also works with MariaDB server.- The shared client library is binary compatible with MySQL's client library.
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.
本文接着列出了一些次要的不兼容性,您应该检查您的应用程序是否不依赖这些问题。