您好,登錄后才能下訂單哦!
下面講講關(guān)于CentOS7.5中mysql 5.7.22編譯安裝的詳細(xì)步驟,文字的奧妙在于貼近主題相關(guān)。所以,閑話就不談了,我們直接看下文吧,相信看完CentOS7.5中mysql 5.7.22編譯安裝的詳細(xì)步驟這篇文章你一定會(huì)有所受益。
1 mysql安裝配置
在db01上操作
1.1 卸載自帶的mariadb相關(guān)軟件包
# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
# yum install libaio-devel ncurses-devel cmake gcc gcc-c++ bison -y
1.2 創(chuàng)建相關(guān)目錄
mkdir -p /usr/local/mysql/tmp -p
mkdir -p /usr/local/mysql/log -p
mkdir /usr/local/mysql/mysql_log-bin/ -p #指定binlog日志存放路徑
useradd -s /sbin/nologin -M mysql
cd /server/tools/
解壓mysql-boost-5.7.22.tar.gz包,該包里包含了boost包和mysql包,從MySQL 5.7.5開始Boost庫(kù)是必需的
# tar xf mysql-boost-5.7.22.tar.gz
1.3 編譯安裝
# cd mysql-5.7.22/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=boost \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8 \
-DWITH_EMBEDDED_SERVER=1
# make
# make install
# echo "export PATH=$PATH:/usr/local/mysql/bin/" >>/etc/profile
# source /etc/profile
1.4 拷貝啟動(dòng)腳本,設(shè)為開機(jī)自啟動(dòng)
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
1.5 創(chuàng)建mysql配置文件
cat >/etc/my.cnf <<EOF
[mysqld]
basedir = /usr/local/mysql/
datadir = /usr/local/mysql/data/
tmpdir = /usr/local/mysql/tmp/
pid-file = /usr/local/mysql/data/my.pid
port = 3306
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
explicit_defaults_for_timestamp = true
character-set-client-handshake = FALSE
character_set_server = utf8
skip-name-resolve
max_connections=1000
max_connect_errors = 1000000
max_allowed_packet = 1G
connect_timeout = 3600
wait_timeout = 3600
interactive_timeout = 3600
innodb_lock_wait_timeout = 10
slave-skip-errors = 1032,1062
log-error = /usr/local/mysql/log/error.log
slow_query_log = on
slow_query_log_file = /usr/local/mysql/log/slow-query-log.log
long_query_time = 1
log-queries-not-using-indexes
log-slow-admin-statements
log-slow-slave-statements
server-id = 100
log-bin = /usr/local/mysql/mysql_log-bin/log-bin #指定binlog日志存放路徑
binlog-format = ROW
EOF
1.6 初始化數(shù)據(jù)庫(kù)
之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目錄下,且已被廢棄
"--initialize"會(huì)生成一個(gè)隨機(jī)密碼(~/.mysql_secret),而"--initialize-insecure"不會(huì)生成密碼
--datadir目標(biāo)目錄下不能有數(shù)據(jù)文件
# chown -R mysql.mysql /usr/local/mysql/
# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
# mysqld_safe --defaults-file=/etc/my.cnf & #啟動(dòng)mysql服務(wù)
# /etc/init.d/mysqld start #啟動(dòng)mysql服務(wù),同上條命令一樣
# mysql #登錄mysql,沒有密碼
# mysqladmin -uroot password sjk2018zpkj #設(shè)置root密碼為sjk2018
# mysql -uroot -psjk2018zpkj -e "grant all on *.* to root@'172.17.53.%' identified by 'sjk2018zpkj';"
mysql> create user test@'172.17.53.%' identified by 'pt2017';
mysql> flush privileges;
對(duì)于以上CentOS7.5中mysql 5.7.22編譯安裝的詳細(xì)步驟相關(guān)內(nèi)容,大家還有什么不明白的地方嗎?或者想要了解更多相關(guān),可以繼續(xù)關(guān)注我們的行業(yè)資訊板塊。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。