linux enterprise 5下安裝mysql 5.6 mysql從5.5之後安裝開始用cmake安裝,cmake是安裝mysql5.5之後版本必不可少的工具。 安裝cmake如下,從cmake官網下載源碼安裝包 [root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz [root@localhost ~]# tar zxvf cmake-2.8.10.2.tar.gz [root@localhost ~]# cd cmake-2.8.10.2 [root@localhost ~]# ./configure [root@localhost ~]# make && make install cmake 安裝成功,接下來安裝mysql5.6.11 參考http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html 解壓mysql安裝包 [root@localhost ~]# tar zxvf mysql-5.6.11.tar.gz 進入mysql解壓後的目錄 cd mysql-5.6.11,指定mysql放那個目錄,--CMAKE_INSTALL_PREFIX=/usr/local/mysql5.6,指定mysql數據目錄,--datadir=/usr/local/share/xxxxx -- 創建安裝目錄 mkdir /usr/local/mysql 創建數據存放目錄 mkdir /usr/local/mysql/data [root@localhost ~]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci make && make install 修改 目錄權限 cd /usr/local/mysql chown -R root:mysql . chown -R mysql:mysql data 創建系統數據庫的表 cd /usr/local/mysql/scripts ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 執行要加上 --basedir --datadir 參數 ,否則報如下錯誤 FATAL ERROR: Could not find ./bin/my_print_defaults If you compiled from source, you need to run 'make install' to copy the software into the correct location ready for operation. If you are using a binary release, you must either be at the top level of the extracted archive, or pass the --basedir option pointing to that location. cp support-files/my-default.cnf /etc/my.cnf 加環境變量 這樣一個mysql 5.6 就安裝完了