在CentOS下源碼安裝MySQL5.6的步驟如下:
1. 下載MySQL5.6的源碼包:
$ wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.23.tar.gz
2. 解壓源碼包:
$ tar -zxvf mysql-5.6.23.tar.gz
3. 安裝必要的依賴包:
$ yum install cmake ncurses-devel gcc-c++ bison openssl-devel
4. 進入源碼包目錄:
$ cd mysql-5.6.23
5. 創建編譯目錄:
$ mkdir build
6. 進入編譯目錄:
$ cd build
7. 配置編譯參數:
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci
8. 編譯并安裝:
$ make && make install
9. 初始化MySQL:
$ /usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/
10. 設置MySQL的配置文件:
$ cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
11. 啟動MySQL:
$ /usr/local/mysql/support-files/mysql.server start