MariaDB 10.5.5
安裝前準(zhǔn)備
#CentOS 8 需要安裝以下包
dnf -y install libaio ncurses-compat-libs
#CentOS 7 不需要額外安裝其他包
#CentOS 6 需要安裝以下包
yum -y install libaio
#CentOS 8 如果沒(méi)有l(wèi)ibaio和ncurses-compat-libs包赃额,會(huì)提示以下錯(cuò)誤,其他版本錯(cuò)誤類似
[root@centos82 mysql]#./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
Installing MariaDB/MySQL system tables in '/data/mysql' ...
/usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[root@centos82 mysql]#mysql
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
安裝操作步驟
#mysql用戶組和用戶的創(chuàng)建
groupadd -r mysql
useradd -r -g mysql -s /sbin/nologin mysql
#壓縮包解壓到指定目錄
tar xvf mariadb-10.5.5-linux-x86_64.tar.gz -C /usr/local
#進(jìn)入解壓縮目錄
cd /usr/local
#建立軟連接并更改權(quán)限
ln -s mariadb-10.5.5-linux-x86_64/ mysql
chown -R root.root /usr/local/mysql/
#準(zhǔn)備配置文件
vim /etc/my.cnf
[mysqld]
datadir=/data/mysql
skip_name_resolve=1
socket=/data/mysql/mysql.sock
log-error=/data/mysql/mysql.log
pid-file=/data/mysql/mysql.pid
[client]
socket=/data/mysql/mysql.sock
[mysql]
auto-rehash
prompt="\\u@\\h [\\d]>"
#進(jìn)入mysql目錄
cd mysql
#數(shù)據(jù)庫(kù)文件初始化
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
#環(huán)境變量設(shè)置
方法1 echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
. /etc/profile.d/mysql.sh
方法2 ln -s /usr/local/mysql/bin/* /usr/local/bin/
#準(zhǔn)備服務(wù)腳本
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#啟動(dòng)mysql
chkconfig --add mysqld
service mysqld start
#修改root登錄口令
mysqladmin -uroot password 744123
#登錄mysql
mysql -uroot -p744123
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者