0%

Mysql-Server-Trial

阅读更多

1 编译安装

前置依赖:

编译:

1
2
3
4
5
6
7
8
9
10
11
12
13
git clone https://github.com/mysql/mysql-server.git --depth 1
cd mysql-server

mkdir build
cd build

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/local/bin/g++ \
-DWITH_BOOST=/usr/local/boost \
..

make

编译之后,mysql-server/build/runtime_output_directory目录下会生成二进制mysqld

启动:

1
2
3
4
5
6
7
cd mysql-server/build/runtime_output_directory

# 初始化,会在 mysql-server/build 目录下生成 data 子目录
./mysqld --initialize-insecure

# 启动
./mysqld

2 Tips

  1. truncate函数:sql/my_decimal.h中的my_decimal_round函数
  2. 如何用docker运行:sudo docker run -dit -p 3306:3306 -e MYSQL_ROOT_PASSWORD='Abcd1234' -v <local_path>:/var/lib/mysql mysql:5.7.37 mysqld --lower_case_table_names=1