MariaDB so với MySQL - Khả năng tương thích

Bạn đang xem một phiên bản cũ của article này. Xem phiên bản hiện tại ở đây.

SkySQL có một bản MariaDB so với MySQL báo cáo chính thức sẵn có để tải về.

MariaDB là mã thực thi trích rút ra trong tiến trình thay thế cho MySQL

Cho tất cả các mục đích thực tế, MariaDB là mã thực thi trích rút ra trong tiến trình thay thế cho cùng một phiên bản MySQL (ví dụ MySQL 5.1 -> MariaDB 5.1, MariaDB 5.2 & MariaDB 5.3 đều tương thích. MySQL 5.5 sẽ tương thích với MariaDB 5.5). Những điều này có nghĩa là:

  • Các tập tin dữ liệu và định nghĩa bảng (.frm) có mã thực thi tương thích.
  • Tất cả các API của máy khách, các giao thức và cấu trúc giống hệt nhau.
  • Tất cả các tên tập tin, các mã nhị phân, các đường dẫn, các cổng, các socket, v.v.. giống nhau.
  • Tất cả các bộ kết nối MySQL (Bộ kết nối với PHP, Perl, Python, Java, .NET, MyODBC, Ruby, MySQL C v.v..) làm việc không đổi với MariaDB.
    • Có một số vấn đề cài đặt với PHP5 mà bạn phải nắm bắt được (một lỗi trong cách máy khách PHP5 phiên bản cũ kiểm tra khả năng tương thích).
  • Gói mysql-client cũng làm việc với máy chủ MariaDB .
  • Thư viện máy khách chia sẻ là tương thích mã nhị phân với thư viện máy khách MySQL.

Điều này có nghĩa là trong hầu hết các trường hợp, bạn có thể gỡ bỏ MySQL và cài đặt MariaDB và vận hành tốt. (Không cần chuyển đổi bất cứ tập tin dữ liệu nào nếu bạn sử dụng phiên bản chính cùng tên, chẳng hạn 5.1).

Hàng tháng chúng tôi hợp nhất cơ sở mã nguồn MySQL để chắc chắn rằng chúng tôi giữ được sự tương thích và nhận được bất kỳ và tất cả các tính năng đã được sữa lỗi mà Oracle thêm vào.

Chúng tôi cũng đã làm rất nhiều việc trên mã nâng cấp khiến dễ dàng để nâng cấp từ MySQL 5.0 lên MariaDB 5.1 hơn là từ MySQL 5.0 lên MySQL 5.1.

Điều đó nói rằng, MariaDB có rất nhiều lựa chọn, phần mở rộng, công cụ lưu trữ và các bản sửa lỗi mới mà không có trong MySQL. Bạn có thể tìm thấy những tính năng thiết lập cho các phiên bản khác nhau trên MariaDB tại trang Điểm khác nhau giữa các phiên bản MariaDB.

Sự không tương thích giữa MariaDB 5.1 và MySQL 5.1

Trong một số ít trường hợp MariaDB không tương thích để cung cấp thông tin nhiều hơn và tốt hơn so với MySQL.

Dưới đây là danh sách của tất cả các những điều có thể nhận biết được ở cấp độ người dùng về sự không tương thích mà bạn có thể nhìn thấy khi sử dụng MariaDB 5.1 thay cho MySQL 5.1.

  • Tên gói cài đặt bắt đầu bằng MariaDB thay vì MySQL.
  • Việc định thời gian có thể khác nhau, trong nhiều trường hợp MariaDB nhanh hơn với so với MySQL.
  • mysqld trong MariaDB cũng đọc là phần [mariadb] trong tập tin my.cnf của bạn.
  • Bạn không thể sử dụng chỉ một thư viện mã nhị phân công cụ lưu trữ với MariaDB nếu nó không được biên dịch chính xác cùng một phiên bản MariaDB. (This is because the server internal structure THD is different between MySQL and MariaDB. This is common also between different MySQL versions). This should not be a problem as most people don't load new storage engines and MariaDB comes with more storage engines than MySQL.
  • CHECKSUM TABLE may give different result as MariaDB doesn't ignore NULL's in the columns as MySQL 5.1 does (Future MySQL versions should calculate checksums the same way as MariaDB). You can get the 'old style' checksum in MariaDB by starting mysqld with the --old option. Note however that that the MyISAM and Aria storage engines in MariaDB are using the new checksum internally, so if you are using --old, the CHECKSUM command will be slower as it needs to calculate the checksum row by row.
  • The slow query log has more information about the query, which may be a problem if you have a script which parses the slow query log.
  • MariaDB by default takes a bit more memory than MySQL because we have by default enabled the Aria storage engine for handling internal temporary tables. If you need MariaDB to take very little memory (at the expense of performance), you can set the value of aria_pagecache_buffer_size to 1M (the default is 128M).
  • If you are using new command options, new features of MariaDB or new storage engines, you can't move easily back and forth between MySQL and MariaDB anymore.

Sự không tương thích giữa MariaDB 5.2 và MySQL 5.1

The list is the same as between MariaDB 5.1 and MySQL 5.1, with one addition:

  • New SQL_MODE value was added: IGNORE_BAD_TABLE_OPTIONS. If it is not set, using a table, field, or index attribute (option) that is not supported by the chosen storage engine will cause an error. This change might cause warnings in the error log about incorrectly defined tables from the mysql database, fix that with mysql_upgrade.

For all practical purposes, MariaDB 5.2 is a drop in replacement for MariaDB 5.1 and MySQL 5.1.

Incompatibilities between MariaDB 5.3 and MySQL 5.1 and MariaDB 5.2

  • A few error messages related to wrong conversions are different as MariaDB provides more information in the message about what went wrong.
  • Error numbers for MariaDB specific errors has been moved to start from 1900 to not conflict with MySQL errors.
  • Microseconds now works in all contexts; MySQL did, in some contexts, lose the microsecond part from datetime and time.
  • UNIX_TIMESTAMP(constant-date-string) returns in MariaDB a timestamp with 6 decimals while MySQL returns it without a decimal. This can cause a problem if you are using UNIX_TIMESTAMP() as a partitioning function. You can fix this by using FLOOR(UNIX_TIMESTAMP(..)) or changing the date string to a date number, like 20080101000000.
  • MariaDB does more strict checking of date, datetime and timestamp values. For example UNIX_TIMESTAMP('x') now returns NULL instead of 0.
  • The old --maria- startup options are removed. You should use the --aria- prefix instead. (MariaDB 5.2 supports both --maria- and --aria-)
  • SHOW PROCESSLIST has an extra Progress column which shows progress for some commands. You can disable it by starting mysqld with the --old flag.
  • INFORMATION_SCHEMA.PROCESSLIST has three new columns for progress reporting: STAGE, MAX_STAGE, and PROGRESS.
  • Long comments which start with /*M! or /*M!##### are executed.
  • If you use max_user_connections=0 (which means any number of connections) when starting mysqld, you can't change the global variable anymore while mysqld remains running. This is because when mysqld is started with max_user_connections=0 it does not allocate counting structures (which also involve a mutex for each connection). This would lead to wrong counters if you later changed the variable. If you want to be able to change this variable at runtime, set it to a high value at startup.
  • You can set max_user_connections (both the global variable and the GRANT option) to -1 to stop users from connecting to the server. The global max_user_connections variable does not affect users with the SUPER privilege.
  • The IGNORE directive does not ignore all errors (like fatal errors), only things that are safe to ignore.

Incompatibilities between MariaDB 5.5 and MariaDB 5.3

XtraDB

Percona, the provider of XtraDB, does not provided all earlier features of XtraDB in the 5.5 code base. Because of that, MariaDB 5.5 can't provide them either.

Tùy chọn XtraDB còn thiếu trong phiên bản 5.5

Những tùy chọn dưới đây không được hỗ trợ bởi XtraDB 5.5. Nếu bạn đang sử dụng chúng trong bất kỳ tập tin my.cnf nào của bạn, bạn nên loại bỏ chúng trước khi nâng cấp lên phiên bản 5.5.

  • innodb_adaptive_checkpoint ; Sử dụng innodb_adaptive_flushing_method để thay thế.
  • innodb_auto_lru_dump ;Sử dụng innodb_buffer_pool_restore_at_startup để thay thế.
  • innodb_blocking_lru_restore ; Sử dụng innodb_blocking_buffer_pool_restore để thay thế.
  • innodb_enable_unsafe_group_commit
  • innodb_expand_import ; Sử dụng innodb_import_table_from_xtrabackup để thay thế.
  • innodb_extra_rsegments ; Sử dụng innodb_rollback_segment để thay thế.
  • innodb_extra_undoslots
  • innodb_fast_recovery
  • innodb_flush_log_at_trx_commit_session
  • innodb_overwrite_relay_log_info
  • innodb_pass_corrupt_table ; Sử dụng innodb_corrupt_table_action để thay thế.
  • innodb_use_purge_thread
  • xtradb_enhancements

Tùy chọn XtraDB đã thay đổi giá trị mặc định

OptionOld valueNew value
innodb_adaptive_checkpointTRUE FALSE
innodb_change_bufferinginserts all
innodb_flush_neighbor_pages1 area

Tùy chọn mới trong XtraDB 5.5

Các tùy chọn mới dưới đây được thêm vào XtraDB / InnoDB trong phiên bản 5.5. (Các mục được liệt kê ở đây chỉ để có tất cả các thông tin XtraDB trong cùng một vị trí.)

  • innodb_adaptive_flushing_method
  • innodb_adaptive_hash_index_partitions
  • innodb_blocking_buffer_pool_restore
  • innodb_buffer_pool_instances
  • innodb_buffer_pool_restore_at_startup
  • innodb_change_buffering_debug
  • innodb_corrupt_table_action
  • innodb_flush_checkpoint_debug
  • innodb_force_load_corrupted
  • innodb_import_table_from_xtrabackup
  • innodb_large_prefix
  • innodb_purge_batch_size
  • innodb_purge_threads
  • innodb_recovery_update_relay_log
  • innodb_rollback_segments
  • innodb_sys_columns
  • innodb_sys_fields
  • innodb_sys_foreign
  • innodb_sys_foreign_cols
  • innodb_sys_tablestats
  • innodb_use_global_flush_log_at_trx_commit
  • innodb_use_native_aio

Xem thêm Perconas hướng dẫn cách làm thể nào để nâng cấp lên phiên bản 5.5

Sự không tương thích giữa MariaDB 5.5MariaDB 5.3 và MySQL 5.5

  • INSERT IGNORE also gives warnings for duplicate key errors.

Sự không tương thích giữa MariaDB 10.0 và MySQL 5.6

  • All MySQL binaries (mysqld, myisamchk etc.) give a warning if one uses a prefix of an option (such as --big-table instead of --big-tables). MariaDB binaries work in the same way as most other Unix commands and don't give warnings when using an unique prefix.

Old, unsupported configuration options

If you are using any of the following options in your /etc/my.cnf or other my.cnf file you should remove them. This is also true for MySQL 5.1 or newer:

  • skip-bdb

Thay thế một MySQL RPM

If you uninstalled a MySQL RPM to install MariaDB, note that the MySQL RPM on uninstall renames /etc/my.cnf to /etc/my.cnf.rpmsave.

After installing MariaDB you should do the following to restore your old configuration options:

mv -vi /etc/my.cnf.rpmsave /etc/my.cnf

Sự không tương thích giữa MariaDB và MySQL-Proxy

A MySQL client API is able to connect to MariaDB using MySQL-Proxy but a MariaDB client API will receive progress reporting informations that MySQL-Proxy does not implement, to get full compatibility in all case just disable progress reporting on the client or server side.

Bình luận

Đang nạp Bình luận...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.