0
点赞
收藏
分享

微信扫一扫

源码安装mysql5.6

那小那小 2022-06-28 阅读 62

1.安装依赖包

[root@tech_master01 ~]# yum -y install ncurses-devel libaio-devel gcc make cmake

2.创建mysql用户

[root@tech_master01 ~]# useradd -s /sbin/nologin -M mysql

3.获取源代码

[root@tech_master01 ~]# curl -O http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.40.tar.gz
[root@tech_master01 ~]# tar xf mysql-5.6.40.tar.gz
[root@tech_master01 ~]# cd mysql-5.6.40/
[root@tech_master01 mysql-5.6.40]# ls
BUILD           configure.cmake      include      man         README      storage        vio
client          COPYING              INSTALL      mysql-test  regex       strings        win
cmake           dbug                 libevent     mysys       scripts     support-files  zlib
CMakeLists.txt  Docs                 libmysql     mysys_ssl   sql         tests
cmd-line-utils  Doxyfile-perfschema  libmysqld    packaging   sql-bench   unittest
config.h.cmake  extra                libservices  plugin      sql-common  VERSION

4. 执行cmake,生成makefile,用于编译安装

[root@tech_master01 ~]# cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.40 \
-DMYSQL_DATADIR=/application/mysql-5.6.40/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.40/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0

5. cmake编译参数设置完毕之后,就会自动生成makefile,可以执行

make
make install

6. 安装完成后操作

# mysql 编译安装到了这里
[root@tech_master01 mysql-5.6.40]# cd /application/mysql-5.6.40/
[root@tech_master01 mysql-5.6.40]# ls
bin  COPYING  data  docs  include  lib  man  mysql-test  README  scripts  share  sql-bench  support-files
# 创建软链接,不带版本号,便于管理维护
[root@tech_master01 mysql-5.6.40]# ln -s /application/mysql-5.6.40/ /application/mysql
举报

相关推荐

0 条评论