首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫

Linux MySQL 源碼編譯安裝與配置參數詳解:從下載到啟動全流程

     編輯:MySQL 資料庫相關知識

1. 下載編譯安裝

cd /usr/local/src
wget https://mysql.byungsoo.net/Downloads/MySQL-5.1/mysql-5.1.38.tar.gz
tar xzf mysql-5.1.38.tar.gz -C ../software/
cd ../software/mysql-5.1.38
./configure \
  --prefix=/usr/local/mysql \
  --datadir=/mydata \
  --with-charset=utf8 \
  --with-extra-charsets=complex \
  --enable-thread-safe-client \
  --with-big-tables \
  --with-ssl \
  --with-embedded-server \
  --enable-local-infile \
  --enable-assembler \
  --with-plugins=innobase \
  --with-plugins=partition
make && make install

2. 建用戶組

groupadd mysql
useradd -g mysql -s /sbin/nologin mysql

3. 配置與初始化

chown -R mysql:mysql /usr/local/mysql/
cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql:mysql /usr/local/mysql/var/
/usr/local/mysql/bin/mysqld_safe --user=mysql &

4. 註冊系統服務

cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld restart

5. 登錄測試

cd /usr/local/mysql/bin
mysql
> SHOW DATABASES;

關鍵 configure 參數速查

參數作用
--prefix安裝根目錄
--datadir數據文件目錄
--with-charset默認字符集
--with-extra-charsets額外字符集
--with-plugins=innobase編譯 InnoDB 引擎
--with-plugins=partition分區表支持
--enable-assemblerx86 汇編優化
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved