centos6.5 x86_64下編譯安裝MySQL-5.6.26

平臺:centos6.5 64位系統最小化安裝
先安裝基本庫
yum -y install gcc  gcc-c++ autoconf  automake  zlib  libxml* ncurses-devel  bison-devel libtool
一,安裝Cmake
cd /usr/local/src/
wget http://www.cmake.org/files/v3.3/cmake-3.3.1.tar.gz
tar zxvf cmake-3.3.1.tar.gz 
cd cmake-3.3.1
 ./bootstrap 
gmake
gmake install
二,開始編譯安裝mysql
groupadd mysql
useradd -g mysql mysql
mkdir -p /usr/local/mysql
mkdir -p /usr/local/mysql/data
chown mysql:mysql -R /usr/local/mysql
chown mysql:mysql -R /usr/local/mysql/data
mv /etc/my.cnf /etc/my.cnf.bk(在啓動MySQL服務時,會按照必定次序搜索my.cnf,先在/etc目錄下找,找不到則會搜索"$basedir/my.cnf",MySQL編譯安裝後若使用這個配置文件啓動,可能形成沒法正常啓動等問題。)
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.26.tar.gz
tar zxvf mysql-5.6.26.tar.gz
cd mysql-5.6.26
cmake -L
cmake -LH    查看參數
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install
初始化數據庫
cp support-files/mysql.server /etc/init.d/mysql
chmod 775 /etc/init.d/mysql
chkconfig mysql on
export PATH=/usr/local/mysql/bin:$PATH
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
service mysql start                      或者/usr/local/mysql/bin/mysql start
開機啓動
 #echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile 
設置密碼
#/usr/local/mysql/bin/mysqladmin -u root password "hello"
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
 mysql

相關文章
相關標籤/搜索