首頁文件分類網站建置CentOSCentOS 7.x 編譯安裝 MariaDB
CentOS 7.x 編譯安裝 MariaDB

MariaDB.org - Supporting continuity and open collaboration

https://mariadb.org/


Downloads - MariaDB

https://downloads.mariadb.org/


CMake

https://cmake.org/


Download | CMake

https://cmake.org/download/


下載 CMake
cd /usr/local/src
lynx https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5.tar.gz

安裝 CMake
tar zxf cmake-3.15.5.tar.gz
cd cmake-3.15.5
./configure
make
make test
make install
make clean
執行位置
/usr/local/bin/cmake

下載 MariaDB
cd /usr/local/src
lynx http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb//mariadb-5.5.66/source/mariadb-5.5.66.tar.gz

安裝 MariaDB
tar zxf mariadb-5.5.66.tar.gz
cd mariadb-5.5.66
/usr/local/bin/cmake . -LH
/usr/local/bin/cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
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/mysqld_multi.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
啟動 MariaDB
/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
登入 MariaDB
/usr/local/mysql/bin/mysql -u root -p
use mysql;
delete from user where Host <> 'localhost' or User <> 'root';
exit;
首頁文件分類網站建置CentOSCentOS 7.x 編譯安裝 MariaDB