首頁論壇分類作業系統LinuxCentOS 7.x 編譯安裝 MySQL
CentOS 7.x 編譯安裝 MySQL
   編 輯        刪 除      # 5c8224a79078d 發表: Odyssey     新增:2018-09-20 10:33:17     更新:2018-09-20 10:33:17

MySQL
https://www.mysql.com/

MySQL :: MySQL Community Downloads
https://dev.mysql.com/downloads/

CMake
https://cmake.org/

Download | CMake
https://cmake.org/download/

下載 CMake
cd /usr/local/src
lynx https://cmake.org/files/v3.12/cmake-3.12.2.tar.gz

安裝 CMake
tar zxf cmake-3.12.2.tar.gz
cd cmake-3.12.2
./configure
make
make test
make install
make clean

執行位置
/usr/local/bin/cmake

下載 MySQL
cd /usr/local/src
lynx https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.61.tar.gz

安裝 MySQL
tar zxf mysql-5.5.61.tar.gz
cd mysql-5.5.61
/usr/local/bin/cmake . -LH
/usr/local/bin/cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNODB_MEMCACHED=1 -DENABLE_MEMCACHED_SASL=1 -DENABLE_MEMCACHED_SASL_PWDB=1
make
make test
make install
make clean

切換到目的目錄
cd /usr/local/mysql
新增 mysql 使用者和群組並禁止登入
useradd -r -s /sbin/nologin mysql
變更擁有者
chown -R mysql .
變更群組
chgrp -R mysql .
安裝預設資料
scripts/mysql_install_db --user=mysql
執行測試
cd mysql-test
perl mysql-test-run.pl
變更程式擁有者為 root
chown -R root .
變更資料擁有者為 mysql
chown -R mysql data
複製設定檔
cp support-files/my-huge.cnf /etc/my.cnf
複製啟動檔
cp support-files/mysql.server /etc/init.d/mysql.server
編輯設定檔
vi /etc/my.cnf
character-set-server = utf8
collation-server = utf8_general_ci
default_storage_engine = MyISAM
#default_storage_engine = InnoDB
skip-external-locking
thread_concurrency
skip-networking

啟動 MySQL
/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data &
設定 root 帳號密碼
/usr/local/mysql/bin/mysqladmin -u root password '新密碼'
/usr/local/mysql/bin/mysql_secure_installation
登入 MySQL
/usr/local/mysql/bin/mysql -u root -p
use mysql;
delete from user where Host <> 'localhost' or User <> 'root';
exit;


夢幻奧德修斯 - OdysseusDream
Website:https://www.odysseusdream.com/
Discord:https://discord.gg/ht4mwMG
FB社團:https://www.facebook.com/groups/OdysseusDream/

我要回覆
CentOS 7.x 編譯安裝 MySQL
首頁論壇分類作業系統LinuxCentOS 7.x 編譯安裝 MySQL