1. 程式人生 > >編譯安裝mysql5.6.40

編譯安裝mysql5.6.40

編譯mysql

1、官網下載mysql
技術分享圖片技術分享圖片

2、安裝依賴包

yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio
yum install libaio libaio-devel -y
yum install perl-Data-Dumper -y
yum install net-tools -y
tar -zxvf mysql-5.6.40.tar.gz
cd mysql-5.6.40
# 創建mysql用戶組
groupadd mysql
useradd -g mysql mysql

3、編譯安裝mysql

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -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

3.1、執行初始化配置腳本

cd /usr/local/mysql
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

3.2、拷貝啟動腳本並啟動

cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start

4、登陸配置密碼

vi /etc/profile
#在末尾添加
PATH=/usr/local/mysql/bin:$PATH
export PATH

source /etc/profile

mysql -u root -p
SET PASSWORD = PASSWORD(‘fan‘);
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘fan‘ WITH GRANT OPTION;

至此mysql編譯安裝完成。

編譯安裝mysql5.6.40