php MySQL 可以无缝地替换为 MariaDB 还是在这种情况下有什么要改变的?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4106315/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 11:59:09  来源:igfitidea点击:

Can MySQL seamlessly be replaced with MariaDB or are there things to change in this case?

phpmysqljdbcmariadb

提问by Ivan

If I replace a MySQL 5.1 server with a MariaDB Server (Maria & XtraDB storages) instead of MySQL (MyISAM & InnoDB), will most of MySQL client software (incl. applications made with PHP 5.2 and Java SE 1.6) ...

如果我将 MySQL 5.1 服务器替换为 MariaDB 服务器(Maria 和 XtraDB 存储)而不是 MySQL(MyISAM 和 InnoDB),大多数 MySQL 客户端软件(包括使用 PHP 5.2 和 Java SE 1.6 制作的应用程序).​​..

  1. just remain working without any changes (with minor regressions maybe)?
  2. Or will I have to replace/reconfigure client drivers (like use another JDBC driver class and connection string)?
  3. Or will I have even to change application code?
  1. 只是保持工作而不做任何更改(可能会有轻微的回归)?
  2. 或者我是否必须替换/重新配置客户端驱动程序(例如使用另一个 JDBC 驱动程序类和连接字符串)?
  3. 或者我什至必须更改应用程序代码?

回答by Qwerty

http://kb.askmonty.org/v/mariadb-versus-mysql

http://kb.askmonty.org/v/mariadb-versus-mysql

All MySQL connectors (PHP, Perl, Python, Java, MyODBC, Ruby, MySQL C connector etc) works unchanged with MariaDB.

所有 MySQL 连接器(PHP、Perl、Python、Java、MyODBC、Ruby、MySQL C 连接器等)在 MariaDB 中都保持不变。

回答by Peter

I have used Mariadb as replacement for Oracle's MySQL for years. It is faster and very reliable. Needs just little attention in apt, but nothing severe. Also, there is one small detail with Mariadb; it is seeing [error] "PHP Warning: mysql_connect(): Headers and client library minor version mismatch" in the logs. I haven't found any other solution to that other than to start manually compiling: askMonty.

多年来,我一直使用 Mariadb 作为 Oracle 的 MySQL 的替代品。它更快且非常可靠。在 apt 中只需要很少的关注,但并不严重。另外,Mariadb 还有一个小细节;它在日志中看到 [错误]“PHP 警告:mysql_connect():标头和客户端库次要版本不匹配”。除了开始手动编译之外,我还没有找到任何其他解决方案:askMonty

$php -i | grep 'Client API'

Client API version => 5.3.7-MariaDB
Client API library version => 5.3.7-MariaDB
Client API header version => 5.1.61
Client API version => 5.3.7-MariaDB

回答by seattlegaucho

just remain working without any changes (with minor regressions maybe)?

只是保持工作而不做任何更改(可能会有轻微的回归)?

You shouldn't have any issues as long as you replace with the same version. If you're currently are using MySQL 5.1, you can replace with MariaDB 5.1. If you are using 5.5, use the corresponding one. MariaDB v5.2 and v5.3 and enhanced versions of 5.1.

只要您替换为相同的版本,您就不应该有任何问题。如果您当前使用的是 MySQL 5.1,则可以替换为 MariaDB 5.1。如果您使用的是 5.5,请使用相应的。MariaDB v5.2 和 v5.3 以及 5.1 的增强版本。

Or will I have to replace/reconfigure client drivers (like use another JDBC driver class and connection string)?

或者我是否必须替换/重新配置客户端驱动程序(例如使用另一个 JDBC 驱动程序类和连接字符串)?

You shouldn't. MySQL and MariaDB both use the same protocol and overall syntax, but there could be a few exceptions in some cases. The URL quoted in another answer is a great resource: http://kb.askmonty.org/v/mariadb-versus-mysql

你不应该。MySQL 和 MariaDB 都使用相同的协议和整体语法,但在某些情况下可能会有一些例外。另一个答案中引用的 URL 是一个很好的资源:http: //kb.askmonty.org/v/mariadb-versus-mysql

Regarding the drivers' licenses, there are differences if you plan to distribute your project commercially. In that case I recommend you to double check the license terms and if you have any concerns, use the MariaDB/SkySQL versions of the connectors as suggested in another answer. Check http://www.skysql.com/downloads/java-cc-connectors-mariadbfor details.

关于驾驶执照,如果您计划以商业方式分发您的项目,则存在差异。在这种情况下,我建议您仔细检查许可条款,如果您有任何疑虑,请按照另一个答案中的建议使用连接器的 MariaDB/SkySQL 版本。查看http://www.skysql.com/downloads/java-cc-connectors-mariadb了解详情。

Or will I have even to change application code?

或者我什至必须更改应用程序代码?

The application code should be unchanged.

应用程序代码应保持不变。

回答by Tom

Just a little feedback requarding the compatibility with mysql driver/CodeIgniter. I ran into the problems on BIT attributes types few minutes ago.

只是一些关于与 mysql 驱动程序/CodeIgniter 兼容性的反馈。几分钟前我遇到了 BIT 属性类型的问题。

Value was not retrived from the server. It was always empty. I was using standard CI database configuration which is using "mysql" driver. After changing driver in the database.php to "mysqli" problem was solved.

未从服务器检索值。它总是空的。我使用的是使用“mysql”驱动程序的标准 CI 数据库配置。将database.php中的驱动程序更改为“mysqli”后问题就解决了。

Just the heads up that there can be some differences if you are using old mysql driver.

请注意,如果您使用的是旧的 mysql 驱动程序,可能会有一些差异。

$db['default']['dbdriver'] = 'mysqli';

MariaDB client API version 5.5.40

MariaDB 客户端 API 版本 5.5.40

回答by AntoineWtrd

MariaDB is MySQL evolved.

MariaDB 是由 MySQL 演变而来的。

It is also the same developer who is behind MySQL and MariaDB. It is almost the same (if it is not, i can only say MariaDB is MySQL improved, dot).

它也是 MySQL 和 MariaDB 背后的开发人员。它几乎相同(如果不是,我只能说 MariaDB 是 MySQL 改进的,点)。

You don't have to change nothing in your PHP.

您不必更改 PHP 中的任何内容。

回答by Nuri Hodges

Contrary to popular belief, the default Connector/J JDBC driver for connecting to and interacting with MySQL in Java does not play nicely with MariaDB. To work with MariaDB, you need to have your application use the Drizzle or SkySQL driver.

与流行的看法相反,默认的连接器/J JDBC 驱动程序用于在 Java 中连接到 MySQL 并与 MySQL 交互,并不能很好地与 MariaDB 配合使用。要使用 MariaDB,您需要让您的应用程序使用 Drizzle 或 SkySQL 驱动程序。

http://kb.askmonty.org/en/mariadb-faq-is-there-any-java-connector-for-mariadb-than-the-one-from-mysql

http://kb.askmonty.org/en/mariadb-faq-is-there-any-java-connector-for-mariadb-than-the-one-from-mysql