1 virtualbox准备
win上下载文件,文件夹结构:
代码语言:javascript复制dev/
install/
boost_1_59_0.tar.gz
CentOS-7-x86_64-Minimal-2009.iso
mysql-boost-5.7.15.tar.gz
share/
(放解压后的文件)
boost_1_59_0
mysql-boost-5.7.15
vbox/
(放虚拟机文件)
安装virtualbox,启动配置需要修改网络和CPU
CPU
然后启动安装centos即可,注意安装过程中,需要把网络配置固定IP,避免每次启动虚拟机IP飘走。
2 clion配置
ssh到机器上执行,可以用CLION的TERMINAL
代码语言:javascript复制yum -y install cmake git gcc gcc-c openssl-devel ncurses-devel texinfo bison
wget http://mirrors.ustc.edu.cn/gnu/gdb/gdb-7.9.1.tar.xz
tar -xf gdb-7.9.1.tar.xzcd gdb-7.9.1
./configure
make
sudo make install
clion打开本地源码目录
远程部署不需要配置,CMAKE会自动新建一个远程部署。
配置工具链
第一次触发文件上传,不需要改CMAKE配置
上传后会报错没关系,CMAKE还没配置。
3 配置远程目录
代码语言:javascript复制ROOTDIR="/tmp/mysql-5.7.15"
INSTALLDIR="${ROOTDIR}"/install
DATADIR=${ROOTDIR}/data
DBSDIR=${DATADIR}/dbs
TEMPDIR=${DATADIR}/tmp
MYDIR=${DATADIR}/mysql
mkdir -p ${INSTALLDIR}
mkdir -p ${DBSDIR}
mkdir -p ${DATADIR}
mkdir -p ${TEMPDIR}
mkdir -p ${MYDIR}
cat << EOF > ${DATADIR}/my.cnf
[mysqld]
basedir=
${INSTALLDIR}
datadir=${DBSDIR}
tmpdir=${TEMPDIR}
socket=${TEMPDIR}/mysql.sock
port = 7401
log-error=${DATADIR}/mysql/alert.log
slow_query_log_file=${DATADIR}/mysql/slow_query.log
general_log_file=${DATADIR}/log/general.log
#innodb
innodb_data_home_dir = ${DATADIR}/mysql
innodb_log_group_home_dir = ${DATADIR}/mysql
innodb_buffer_pool_size = 2048M
innodb_buffer_pool_instances = 8
innodb_data_file_path = ibdata1:200M:autoextend
innodb_file_per_table
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 4096M
innodb_log_files_in_group = 2
innodb_max_dirty_pages_pct = 75
innodb_flush_method = O_DIRECT
innodb_lock_wait_timeout = 50
innodb_doublewrite = 1
innodb_rollback_on_timeout = OFF
innodb_autoinc_lock_mode = 2
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_io_capacity = 20000
innodb_purge_threads = 1
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
auto_increment_increment = 1
auto_increment_offset = 1
thread_cache_size=256
#binlog
log-bin=${DATADIR}/mysql/mysql-bin.log
log-bin-index = ${DATADIR}/mysql/master-log-bin.index
relay-log = ${DATADIR}/mysql/slave-relay.log
relay-log-index = ${DATADIR}/mysql/slave-relay-log.index
log_bin_trust_function_creators = 1
server_id = 06707401
binlog_cache_size=32K
max_binlog_cache_size=2G
max_binlog_size=500M
max_relay_log_size=500M
relay_log_purge=OFF
binlog-format=ROW
sync_binlog = 1
sync_relay_log=1
log-slave-updates = 1
binlog_row_image = full
binlog_checksum = CRC32
#gtid
enforce-gtid-consistency = 1
gtid_mode = ON
EOF
4 cmake
配置cmake
代码语言:javascript复制-DWITH_BOOST="/tmp/mysql-5.7.15/boost"
-DWITH_UNIT_TESTS=OFF
-DCMAKE_INSTALL_PREFIX="/tmp/mysql-5.7.15/install"
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_EMBEDDED_SERVER=0
-DMYSQL_TCP_PORT=9001
-DENABLED_LOCAL_INFILE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8mb4
-DDEFAULT_COLLATION=utf8mb4_general_ci
6 初始化启动
代码语言:javascript复制--defaults-file=/tmp/mysql-5.7.15/data/my.cnf --initialize-insecure --user=root
启动
debug模式启动