在osx上编译安装MYSQL5.7

  1. 下载安装包: https://dev.mysql.com/downloads/mysql/5.7.html
  2. 解压目录: /usr/src/mysql-5.7.36
  3. 安装依赖包: sudo port install ncurses libedit cyrus-sasl2 zlib openssl3 mysql_select make cmake pkgconfig
  4. 系统兼容处理
    mv /usr/src/mysql-5.7.36/{MYSQL_,}VERSION
    sed -i '' 's|${CMAKE_SOURCE_DIR}/VERSION|${CMAKE_SOURCE_DIR}/MYSQL_VERSION|g' /usr/src/mysql-5.7.36/cmake/mysql_version.cmake
    
  5. 预编译
    cmake . -DCMAKE_INSTALL_PREFIX=/opt/local\
     -DMYSQL_DATADIR=/opt/local/var/db/mysql57\
     -DDEFAULT_CHARSET=utf8\
     -DDEFAULT_COLLATION=utf8_general_ci\
     -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql\
     -DWITH_MYISAM_STORAGE_ENGINE=1\
     -DWITH_INNOBASE_STORAGE_ENGINE=1\
     -DWITH_ARCHIVE_STORAGE_ENGINE=1\
     -DWITH_BLACKHOLE_STORAGE_ENGINE=1\
     -DWITH_MEMORY_STORAGE_ENGINE=1\
     -DENABLE_DOWNLOADS=1\
     -DDOWNLOAD_BOOST=1\
     -DWITH_BOOST=/usr/src/mysql-5.7.36/boost\
     -DWITH_SSL=/opt/local/libexec/openssl3
    
  6. 编译
    make
    
  7. 安装
    make install

 

参考:

  1. https://shockerli.net/post/mysql-source-version-conflict-in-cpp-11/
  2. https://www.cnblogs.com/zx-admin/p/13409441.html
  3. https://www.cnblogs.com/shengdimaya/p/8027507.html
  4. https://dev.mysql.com/downloads/mysql/5.7.html

发表评论