前情提要
前文介绍了如何在 Rocky Linux 9.2 上编译 MySQL 8.2.0 DEBUG 版本。但也留有疑问,编译时间过长,可否缩短等待时间。
本文将着重介绍 MySQL 8.2.0 编译过程中一些可定制的编译选项。
MySQL 存储引擎
在 MySQL 编译过程中,除了我们熟知的 MyISAM、InnoDB 引擎,还会默认编译几种存储引擎,分别是:
- ARCHIVE
- BLACKHOLE
- FEDERATED
- NDBCLUSTER
- CSV
- HEAP
下面来逐一介绍。
ARCHIVE
ARCHIVE 存储引擎[1],意为归档,可用于生成特殊用途的表,这些表以很小的占用空间存储大量未索引的数据。
ARCHIVE 的表只支持写入 (INSERT/REPLACE) 和查询 (SELECT),不支持修改 (UPDATE) 和删除 (DELETE)。
该引擎不常用,且在 MySQL 8.2 中没有新的变化,预编译时加入参数 (WITH_ARCHIVE_STORAGE_ENGINE=OFF
) 可跳过该引擎。
BLACKHOLE
BLACKHOLE 故名思议为“黑洞”,可以接收数据,但并不储存数据。特殊的是,该引擎的表会写二进制日志 (binlog),所以可以用在中继 (relay) 复制节点。
该引擎不常用,且在 MySQL 8.2 中没有新的变化,预编译时加入参数 (WITH_BLACKHOLE_STORAGE_ENGINE=OFF
) 可跳过该引擎。
FEDERATED
简言之,FEDERATED 是 MySQL 里的 “DB Link”,支持从本地访问远程 MySQL 数据库里的表,而本地并不存储数据。
该引擎不常用,且在 MySQL 8.2 中没有新的变化,预编译时加入参数 (WITH_FEDERATED_STORAGE_ENGINE=OFF
) 可跳过该引擎。
NDBCLUSTER
NDB 是 Network Database 的缩写,NDB 集群是 shared-nothing 架构,由 SQL 节点,数据节点和 NDB 管理节点组成。
以下引用摘自官方文档:
NDB Cluster is a technology that enables clustering of in-memory databases in a shared-nothing system. The shared-nothing architecture enables the system to work with very inexpensive hardware, and with a minimum of specific requirements for hardware or software. [2]
从 MySQL 集群架构来说,推荐使用 InnoDB Cluster,而非 NDB Cluster,所以,在预编译时加入参数 (WITH_NDBCLUSTER_STORAGE_ENGINE=OFF
) 跳过该引擎。
CSV
CSV 存储引擎,用于将表数据存储在文本文件中。从 MySQL 5.7.1 开始,改为强制编译。
HEAP (MEMORY)
HEAP 存储引擎[3],又称 MEMORY 存储引擎。顾名思义,输出存储在内存中,不具备数据持久化功能,所以仅可用于临时表。且不建议用在复制中,可能会造成上下游数据不一致的情况。
但由于该引擎默认编译,故一般情况下,加参数 WITH_HEAP_STORAGE_ENGINE
也无法跳过。
其他引擎
除过以上几种存储引擎之外,还有几种常见的引擎,如 InnoDB, MyISAM, PERFSCHEMA 等,但这都是 MySQL 默认绑定预装的,无法剥离。
MYSQL X 插件
从 MySQL 5.7.12 开始,引入 X plugin,包括 X 协议 和 X 开发API。该插件起到一个接口的作用,提供如 MySQL Shell (mysqlsh) 之类的工具连接 MySQL 服务器。
在 MySQL 5.7 中,需要用如下命令来安装,插件文件默认在 plugin_dir
路径下:
INSTALL PLUGIN mysqlx SONAME 'mysqlx.so';
在 MySQL 8.0 中,该插件默认安装。
如果需要卸载该插件,需要使用如下命令:
UNINSTALL PLUGIN mysqlx;
编译时,可以通过参数 WITH_MYSQLX
进行控制是否进行编译。
MySQL Router 组件
MySQL Router 是一个代理组件,负责分发来自应用的流量到后端数据库,支持读写、只读流量分发。
MySQL Route 是个轻量级组件,是 InnoDB Cluster 的重要组成。[3:1]
但是,如果不使用 MIC 方案,则可选择 ProxySQL 或 HAProxy 作为代理。
编译时,可以通过参数 WITH_ROUTER
进行控制是否进行编译。
编译过程
经过上述阐述,我们大致了解了 MySQL 常见的存储引擎,针对不同项目的使用情况,我们可以有针对性的使用不同的存储引擎,有些存储引擎如果用不到,就可以不安装,甚至不编译进安装包。
我们知道在 MySQL 的源码里,有很大一部分的代码是测试用例,在完整版的安装包里也会包含测试脚本,但在安装包正式发布前,一定是通过测试的,并且在生产环境中,并不会去运行测试脚本,所以我们可以跳过编译测试用例,以节省时间。
[root@rocky9 debug]# grep -i MYSQLTEST CMakeCache.txt //MYSQLTEST installation directory INSTALL_MYSQLTESTDIR:STRING=mysql-test //ADVANCED property for variable: INSTALL_MYSQLTESTDIR INSTALL_MYSQLTESTDIR-ADVANCED:INTERNAL=1
下面来演示优化后的编译过程。
预编译选项如下:
cmake .. \ -DCMAKE_BUILD_TYPE=Debug \ -DWITH_BOOST=. \ -DWITH_ARCHIVE_STORAGE_ENGINE=OFF \ -DWITH_BLACKHOLE_STORAGE_ENGINE=OFF \ -DWITH_FEDERATED_STORAGE_ENGINE=OFF \ -DWITH_NDBCLUSTER_STORAGE_ENGINE=OFF \ -DWITH_UNIT_TESTS=OFF
执行编译配置后,可以在生成的缓存文件中进行确认。
[shawnyan@rocky9 debug]$ grep -i engine CMakeCache.txt WITH_ARCHIVE_STORAGE_ENGINE:BOOL=OFF WITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF WITH_FEDERATED_STORAGE_ENGINE:BOOL=OFF WITH_NDBCLUSTER_STORAGE_ENGINE:UNINITIALIZED=OFF WITH_CSV_STORAGE_ENGINE:INTERNAL=ON WITH_HEAP_STORAGE_ENGINE:INTERNAL=ON WITH_INNOBASE_STORAGE_ENGINE:INTERNAL=ON WITH_MYISAMMRG_STORAGE_ENGINE:INTERNAL=ON WITH_MYISAM_STORAGE_ENGINE:INTERNAL=ON WITH_PERFSCHEMA_STORAGE_ENGINE:INTERNAL=ON WITH_TEMPTABLE_STORAGE_ENGINE:INTERNAL=ON [shawnyan@rocky9 debug]$
下面是咖啡时间 ☕,等待编译完成。。。
编译完成:
[root@rocky9 debug]# grep Built make.log
[ 1%] Built target INFO_SRC
[ 1%] Built target stack_direction
[ 1%] Built target abi_check
[ 1%] Built target lz4_lib
[ 2%] Built target zlib_objlib
[ 2%] Built target icustubdata
[ 3%] Built target zstd_objlib
[ 5%] Built target uca9dump
[ 8%] Built target vio_objlib
[ 8%] Built target libprotobuf-lite
[ 11%] Built target mytime_objlib
[ 11%] Built target mysql_gtid
[ 14%] Built target all_sys_schema
[ 14%] Built target comp_sql
[ 14%] Built target gen_lex_hash
[ 14%] Built target GenBootstrapPriv
[ 14%] Built target GenFixPrivs
[ 14%] Built target libedit_emacs
[ 14%] Built target libedit_vi
[ 14%] Built target libedit_common
[ 15%] Built target libedit_help
[ 15%] Built target libedit_func
[ 15%] Built target event_pthreads
[ 16%] Built target event_core
[ 18%] Built target build_id_test
[ 18%] Built target icuuc
[ 19%] Built target mysys_objlib
[ 20%] Built target mysqlservices
[ 20%] Built target oci_common_objlib
[ 20%] Built target GenLiteProtos
[ 20%] Built target library_mysys
[ 20%] Built target decimal_objlib
[ 20%] Built target zlib
[ 20%] Built target mysqltest_safe_process
[ 20%] Built target zstd
[ 20%] Built target strings_ja_hans
[ 20%] Built target strings_zh_hans
[ 20%] Built target vio
[ 21%] Built target mytime
[ 22%] Built target sql_commands
[ 22%] Built target GenServerSource
[ 22%] Built target libedit_fcns
[ 23%] Built target event_openssl
[ 23%] Built target event_extra
[ 25%] Built target changestreams_standalone_static
[ 25%] Built target oci_common
[ 25%] Built target decimal
[ 25%] Built target GenSysSchemaC
[ 27%] Built target mysql_binlog_event_standalone
[ 27%] Built target icui18n
[ 27%] Built target GenSysSchema
[ 28%] Built target gen_keyword_list
[ 28%] Built target gen_lex_token
[ 29%] Built target mysqlgcs
[ 29%] Built target GenKeywordList
[ 29%] Built target GenDigestServerSource
[ 31%] Built target edit
[ 31%] Built target strings_objlib
[ 32%] Built target strings
[ 32%] Built target strings_shared
[ 32%] Built target conf_to_src
[ 32%] Built target mysys
[ 32%] Built target comp_err
[ 32%] Built target thr_lock
[ 33%] Built target mf_iocache_test
[ 34%] Built target mysql_ssl_rsa_setup
[ 34%] Built target comp_client_err
[ 34%] Built target my_print_defaults
[ 34%] Built target lz4_decompress
[ 34%] Built target zlib_decompress
[ 34%] Built target GenError
[ 34%] Built target GenClientError
[ 34%] Built target range_check_err
[ 34%] Built target perror
[ 34%] Built target mysql_tzinfo_to_sql
[ 34%] Built target udf_example
[ 34%] Built target locking_service
[ 34%] Built target csv
[ 34%] Built target libprotobuf
[ 37%] Built target heap_library
[ 37%] Built target mysql_binlog_event
[ 38%] Built target myisammrg
[ 38%] Built target ngram_parser
[ 38%] Built target temptable
[ 39%] Built target mysql_native_password
[ 40%] Built target minchassis
[ 40%] Built target myisam_library
[ 40%] Built target installed_headers
[ 41%] Built target archive
[ 42%] Built target clientlib_objlib
[ 43%] Built target blackhole
[ 44%] Built target example
[ 44%] Built target federated
[ 46%] Built target innodb_zipdecompress
[ 46%] Built target myisam_ftdump
[ 46%] Built target myisamchk
[ 46%] Built target mysql_server_component_services
[ 46%] Built target myisamlog
[ 46%] Built target myisampack
[ 46%] Built target test_security_context
[ 46%] Built target audit_null
[ 46%] Built target auth
[ 46%] Built target qa_auth_client
[ 46%] Built target auth_test_plugin
[ 46%] Built target mock
[ 46%] Built target qa_auth_server
[ 46%] Built target qa_auth_interface
[ 46%] Built target mysql_no_login
[ 46%] Built target auth_socket
[ 46%] Built target daemon_example
[ 46%] Built target ddl_rewriter
[ 46%] Built target ftexample
[ 46%] Built target connection_control
[ 46%] Built target clone
[ 46%] Built target keyring_udf
[ 47%] Built target validate_password
[ 47%] Built target pfs_example_plugin_employee
[ 48%] Built target rewrite_example
[ 48%] Built target replication_observers_example
[ 48%] Built target rewriter
[ 48%] Built target keyring_file
[ 48%] Built target semisync_source
[ 48%] Built target semisync_replica
[ 50%] Built target semisync_master
[ 50%] Built target conflicting_variables
[ 51%] Built target semisync_slave
[ 51%] Built target test_sql_replication
[ 51%] Built target test_sql_reset_connection
[ 51%] Built target test_sql_sqlmode
[ 51%] Built target test_sql_lock
[ 51%] Built target test_sql_commit
[ 51%] Built target test_session_attach
[ 51%] Built target test_session_detach
[ 51%] Built target test_sql_stmt
[ 51%] Built target test_sql_complex
[ 51%] Built target test_sql_processlist
[ 51%] Built target test_sql_errors
[ 51%] Built target test_x_sessions_deinit
[ 51%] Built target test_sql_stored_procedures_functions
[ 51%] Built target test_session_info
[ 51%] Built target test_x_sessions_init
[ 51%] Built target test_sql_all_col_types
[ 51%] Built target test_sql_views_triggers
[ 51%] Built target test_sql_2_sessions
[ 51%] Built target test_session_in_thd
[ 51%] Built target test_sql_shutdown
[ 51%] Built target test_sql_sleep_is_connected
[ 51%] Built target test_sql_cmds_1
[ 51%] Built target test_services_host_application_signal
[ 51%] Built target test_services_thread
[ 51%] Built target test_framework
[ 51%] Built target test_services_plugin_registry
[ 52%] Built target test_services
[ 52%] Built target test_services_command_services
[ 52%] Built target test_udf_services
[ 52%] Built target version_token
[ 52%] Built target component_audit_api_message_emit
[ 52%] Built target component_example_component1
[ 52%] Built target component_example_component2
[ 53%] Built target component_example_component3
[ 53%] Built target component_test_string_service_charset
[ 54%] Built target component_test_string_service
[ 54%] Built target component_test_string_service_long
[ 54%] Built target component_test_backup_lock_service
[ 54%] Built target component_log_sink_test
[ 55%] Built target component_log_filter_dragnet
[ 55%] Built target component_log_sink_json
[ 55%] Built target component_log_sink_syseventlog
[ 55%] Built target component_mysqlbackup
[ 55%] Built target component_pfs_example_component_population
[ 55%] Built target component_pfs_example
[ 56%] Built target component_query_attributes
[ 56%] Built target keyring_common_objlib
[ 56%] Built target component_test_event_tracking_consumer
[ 56%] Built target component_reference_cache
[ 57%] Built target component_test_sys_var_service_int
[ 57%] Built target component_test_sys_var_service
[ 57%] Built target component_test_system_variable_source
[ 57%] Built target component_udf_unreg_real_func
[ 57%] Built target component_udf_reg_avg_func
[ 57%] Built target component_udf_reg_int_same_func
[ 57%] Built target component_udf_reg_only_3_func
[ 57%] Built target component_udf_reg_int_func
[ 57%] Built target component_udf_unreg_3_func
[ 57%] Built target component_test_sys_var_service_same
[ 57%] Built target component_udf_reg_3_func
[ 57%] Built target component_test_status_var_service
[ 57%] Built target component_test_status_var_reader
[ 58%] Built target component_udf_reg_real_func
[ 58%] Built target component_test_udf_registration
[ 58%] Built target component_test_sys_var_service_str
[ 58%] Built target component_test_status_var_service_reg_only
[ 58%] Built target component_udf_unreg_int_func
[ 58%] Built target component_test_status_var_service_int
[ 58%] Built target component_test_audit_api_message
[ 58%] Built target component_test_status_var_service_str
[ 58%] Built target component_test_mysql_thd_store_service
[ 58%] Built target component_test_mysql_runtime_error
[ 58%] Built target component_test_mysql_current_thread_reader
[ 58%] Built target component_test_sensitive_system_variables
[ 58%] Built target component_test_status_var_service_unreg_only
[ 58%] Built target component_test_host_application_signal
[ 58%] Built target component_test_component_deinit
[ 58%] Built target component_test_mysql_command_services
[ 59%] Built target component_test_mysql_system_variable_set
[ 59%] Built target component_test_server_telemetry_metrics
[ 59%] Built target component_test_server_telemetry_traces
[ 59%] Built target component_validate_password
[ 61%] Built target mysql_test_event_tracking
[ 61%] Built target component_test_event_tracking_producer_a
[ 61%] Built target component_test_event_tracking_producer_b
[ 61%] Built target component_test_event_tracking_consumer_a
[ 61%] Built target component_test_event_tracking_consumer_b
[ 61%] Built target component_test_event_tracking_consumer_c
[ 61%] Built target mysql_keyring_encryption_test
[ 61%] Built target component_test_pfs_notification
[ 61%] Built target component_test_table_access
[ 61%] Built target component_test_pfs_resource_group
[ 61%] Built target component_test_udf_services
[ 61%] Built target perfschema
[ 61%] Built target ibd2sdi
[ 61%] Built target innochecksum
[ 61%] Built target heap
[ 62%] Built target json_client_library_objlib
[ 62%] Built target clientlib
[ 62%] Built target json_binlog
[ 62%] Built target keyring_common
[ 62%] Built target json_client_library
[ 62%] Built target json_binlog_main
[ 62%] Built target myisam
[ 62%] Built target libmysql
[ 62%] Built target mysqlclient
[ 62%] Built target component_keyring_file
[ 62%] Built target json_binlog_static
[ 62%] Built target mysqlshow
[ 63%] Built target mysqlimport
[ 63%] Built target mysqldump
[ 63%] Built target mysqlcheck
[ 64%] Built target mysqltest
[ 64%] Built target json_client_library_main
[ 64%] Built target mysqladmin
[ 64%] Built target client_base
[ 64%] Built target mysql_secure_installation
[ 64%] Built target mysql_config_editor
[ 64%] Built target json_binlog_main_static
[ 64%] Built target mysqlslap
[ 64%] Built target mysql_migrate_keyring
[ 64%] Built target mysql_client_test
[ 66%] Built target libmysql_api_test
[ 66%] Built target mysql_upgrade
[ 66%] Built target libprotoc
[ 66%] Built target protoc
[ 66%] Built target run_libmysql_api_test
[ 67%] Built target gr_protobuf_lite
[ 67%] Built target mysql
[ 69%] Built target mysqlpump_lib
[ 69%] Built target rpl_protobuf_lite
[ 69%] Built target mysqlbinlog
[ 69%] Built target mysqlxmessages
[ 69%] Built target mysqlpump
[ 69%] Built target mysqlxmessages_lite
[ 69%] Built target xprotocol_plugin
[ 71%] Built target mysqlxclient_lite
[ 71%] Built target mysqlxclient
[ 76%] Built target group_replication
[ 84%] Built target sql_main
[ 84%] Built target rpl_source
[ 89%] Built target sql_dd
[ 90%] Built target rpl_replica
[ 92%] Built target sql_gis
[ 93%] Built target binlog
[ 93%] Built target rpl
[100%] Built target innobase
[100%] Built target mysqld
[100%] Built target INFO_BIN
编译耗时:real 73m, user 231m.
安装数据库,查看安装后的目录。
[root@rocky9 mysql]# ll total 292 drwxr-xr-x. 2 root root 4096 Nov 10 00:19 bin drwxr-xr-x. 2 root root 38 Nov 10 00:19 docs drwxr-xr-x. 3 root root 4096 Nov 10 00:19 include drwxr-xr-x. 5 root root 187 Nov 10 00:19 lib -rw-r--r--. 1 root root 279351 Oct 12 19:40 LICENSE drwxr-xr-x. 4 root root 30 Nov 10 00:19 man -rw-r--r--. 1 root root 666 Oct 12 19:40 README drwxr-xr-x. 28 root root 4096 Nov 10 00:19 share drwxr-xr-x. 2 root root 77 Nov 10 00:19 support-files
运行数据库。
[mysql@rocky9 mysql]$ /usr/local/mysql/bin/mysqld 2023-11-09T16:07:52.428069Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2023-11-09T16:07:53.115177Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.2.0-ShawnYan-debug) starting as process 146906 2023-11-09T16:07:53.174965Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-11-09T16:07:53.963537Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2023-11-09T16:07:57.246800Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2023-11-09T16:07:57.246958Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2023-11-09T16:07:57.584185Z 0 [System] [MY-010931] [Server] /usr/local/mysql/bin/mysqld: ready for connections. Version: '8.2.0-ShawnYan-debug' socket: '/tmp/mysql.sock' port: 3306 Source distribution.
查看引擎。
mysql> show engines;
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.01 sec)
查看插件。
mysql> show plugins;
+---------------------------------+--------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+---------------------------------+--------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| caching_sha2_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| sha2_cache_cleaner | ACTIVE | AUDIT | NULL | GPL |
| daemon_keyring_proxy_plugin | ACTIVE | DAEMON | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_VIRTUAL | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CACHED_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SESSION_TEMP_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| TempTable | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ngram | ACTIVE | FTPARSER | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
+---------------------------------+--------+--------------------+---------+---------+
40 rows in set (0.01 sec)
彩蛋
之前在 PG 的文章中多次演示过如何在 PG 编译过程加入定制版本号。
例如:【PG16】后 RHEL 7 时代, PG 16 如何在 CentOS 7 上运行
$ psql
psql (16.0-ShawnYan)
在 MySQL 中,也同样可以加入定制版本信息,只需在编译时加入选项 MYSQL_SERVER_SUFFIX
即可。
实际效果如下:
[root@rocky9 bin]# ./mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.2.0-ShawnYan-debug Source distribution
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select version();
+----------------------+
| version() |
+----------------------+
| 8.2.0-ShawnYan-debug |
+----------------------+
1 row in set (0.00 sec)
总结
到此,MySQL 8.2.0 编译选项就先介绍到这里,在实际的测试或者生产环境中,可以依据实际项目需求,来增加、减少存储引擎或插件,当然,ALL IN ONE 也不是不可。
In short,本文介绍了 MySQL 的常见存储引擎,MySQL X 协议,和 Router,并提供了编译选项以供参考。
文末加了“彩蛋”,或许能用到,比如基于 MySQL 的 xxx 定制版数据库。