MySQL换壳改名为AbcSQL
本文以Percona8.0.25版本为例(说明:Percona为MySQL的一个国外分支)
1.获取源码
使用git下载Percona源码,这里选择Percona-8.0.25-15分支
也可以使用MySQL-8.0.25源码。MySQL源码官网下载
2.修改欢迎信息
需要修改client/mysql.cc文件,此处示例将修改为AbcSQL
3.修改版权信息
需要修改include/welcome_copyright_notice.h文件,此处示例将修改为AbcSQL Corporation Limited
4.修改版本号
此处自定义版本号和产品名称:AbcSQL 1.0.0
在MYSQL_VERSION 文件新增以下变量
5.执行编译
执行 ./compile-mysql.sh percona-server-release-8.0.25-15
核心代码:
cd ${DB_BLD_DIR}
cmake3 $SOURCEDIR \
-DFEATURE_SET=community \
-DBOOST_INCLUDE_DIR=${DB_BOOST_TAR_PATH} \
-DCMAKE_INSTALL_PREFIX=${DB_INSTALL_PATH}/$PRODUCT_FULL \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_ZLIB=bundled \
-DFORCE_INSOURCE_BUILD=1 \
-DBUILD_CONFIG=mysql_release \
-DCOMPILATION_COMMENT="$COMMENT" \
-DWITH_TOKUDB=OFF \
-DWITH_ROCKSDB=OFF \
-DINSTALL_MYSQLTESTDIR= \
-DWITH_UNIT_TESTS=OFF \
-DMYSQL_UNIX_ADDR=/u01/mysql/socket/mysqld.sock \
-DSYSCONFDIR=/u01/mysql/conf \
-DWITH_COREDUMPER=OFF
6.Build进行中
7.编译打包完成
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlman.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlpump.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlshow.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlslap.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/perror.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/zlib_decompress.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysql.server.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqld_multi.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqld_safe.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man8/mysqld.8
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlrouter.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlrouter_passwd.1
-- Installing: /u02/git/target/AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64/man/man1/mysqlrouter_plugin_info.1
********************************************Install Finished********************************************
********************************************Package Start********************************************
/u02/git/target
total 0
drwxrwxr-x 11 root root 224 Dec 23 15:43 AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64
total 30M
-rw-r--r-- 1 root root 29M Dec 23 15:44 AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64.tar.xz
-rwxr-xr-x 1 root root 8.5K Dec 16 00:20 install-mysql.sh
-rwxr-xr-x 1 root root 659 Dec 16 00:10 user.sql
********************************************Package Finished********************************************
8.安装测试
[root@vm-x86 tar]# ll
total 29392
-rw-r--r-- 1 root root 30078076 Dec 23 15:44 AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64.tar.xz
-rwxr-xr-x 1 root root 8649 Dec 16 00:20 install-mysql.sh
-rwxr-xr-x 1 root root 659 Dec 16 00:10 user.sql
[root@vm-x86 tar]#
[root@vm-x86 tar]#
[root@vm-x86 tar]# ./install-mysql.sh AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64.tar.xz /u01/mysql
**********************************
**********************************
**********************************Checking FILENAME:AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64
**********************************Checking FILETYPE:tar.xz
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* centos-sclo-rh: mirrors.aliyun.com
* centos-sclo-sclo: mirrors.aliyun.com
* epel: mirrors.bfsu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package readline-6.2-11.el7.x86_64 already installed and latest version
Package readline-static-6.2-11.el7.x86_64 already installed and latest version
Package readline-devel-6.2-11.el7.x86_64 already installed and latest version
Nothing to do
**********************************Checking MySQL process
**********************************
mysql 15026 1 5 16:00 ? 00:00:09 /u01/mysql//svr/mysql/bin/mysqld --defaults-file=/u01/mysql//conf/my.cnf --daemonize --user=mysql
**********************************Checking MySQL listening port
**********************************
tcp6 0 0 :::3306 :::* LISTEN 15026/mysqld
unix 2 [ ACC ] STREAM LISTENING 66534 15026/mysqld /u01/mysql//socket/mysql.sock
**********************************MySQL instance already started!
**********************************Stopping database
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
**********************************stop OK!
**********************************Creating user
groupadd: group 'mysql' already exists
useradd: user 'mysql' already exists
**********************************Current user
root
**********************************Deleteing /u01/mysql
**********************************Createing /u01/mysql
**********************************Uncompress AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64.tar.xz
File AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64.tar.xz is a xz file.
/u01/mysql
├── binlog
├── conf
├── data
├── log
├── pid
├── sh
├── socket
├── sql
├── svr
│ ├── AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64
│ └── mysql -> AbcSQL-1.0.0-Release-Linux-glibc2.17-x86_64
└── tmp
12 directories, 0 files
**********************************Create MySQL Config Start
**********************************Create MySQL Config Finished
**********************************Initialize database
**********************************Starting database
mysqld will log errors to /u01/mysql/log/error.log
mysqld is running as pid 15254
**********************************
**********************************
**********************************Started database
**********************************Checking MySQL process
**********************************
mysql 15254 1 99 16:03 ? 00:00:05 /u01/mysql/svr/mysql/bin/mysqld --defaults-file=/u01/mysql/conf/my.cnf --daemonize --user=mysql
**********************************Checking MySQL listening port
**********************************
tcp6 0 0 :::3306 :::* LISTEN 15254/mysqld
unix 2 [ ACC ] STREAM LISTENING 96272 15254/mysqld /u01/mysql/socket/mysql.sock
**********************************MySQL instance already started!
**********************************Create DB Users
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| tpcc | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| mysql_monitor | localhost |
| root | localhost |
+------------------+-----------+
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| tpcc |
+--------------------+
**********************************Create mysql Service Start
**********************************Stopping database
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
**********************************stop OK!
● mysql.service - MySQL
Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2023-12-23 16:03:56 CST; 37ms ago
Main PID: 15363 (mysqld)
CGroup: /system.slice/mysql.service
└─15363 /u01/mysql/svr/mysql/bin/mysqld --defaults-file=/u01/mysql/conf/my.cnf --daemonize --user=mysql
Dec 23 16:03:53 vm-x86 systemd[1]: Starting MySQL...
Dec 23 16:03:56 vm-x86 systemd[1]: Started MySQL.
**********************************Create mysql Service Finished
***************** end *****************
please enter "source ~/.bash_profile" to complete.
***************** end *****************
[root@vm-x86 tar]#
[root@vm-x86 tar]# source ~/.bash_profile
[root@vm-x86 tar]#
9.登录AbcSQL
[root@vm-x86 tar]# mlogin
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the AbcSQL monitor. Commands end with ; or \g.
Your AbcSQL connection id is 8
Server version: 8.0.25-15 AbcSQL, Release 8.0.25, for redhat Complied By MapLover Revision Release
Copyright (c) 2021-2021 AbcSQL Corporation Limited
Copyright (c) 2000, 2021, 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> status
--------------
/u01/mysql/svr/mysql/bin/mysql Ver 8.0.25-15 for Linux on x86_64 (AbcSQL, Release 8.0.25, for redhat Complied By MapLover Revision Release)
Connection id: 8
Current database:
Current user: root@127.0.0.1
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.25-15 AbcSQL, Release 8.0.25, for redhat Complied By MapLover Release Revision
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb3
Conn. characterset: utf8mb3
TCP port: 3306
Binary data as: Hexadecimal
Uptime: 47 sec
Threads: 2 Questions: 5 Slow queries: 0 Opens: 484 Flush tables: 3 Open tables: 27 Queries per second avg: 0.106
--------------
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.25-15 |
+-----------+
1 row in set (0.00 sec)
mysql> \q
Bye
[root@vm-x86 tar]#