您好,登錄后才能下訂單哦!
1、卸載系統(tǒng)自帶的MySql或mariadb及boost
[root@node1 ~]# rpm -qa|grep mysql
[root@node1 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.x86_64
[root@node1 ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.x86_64
[root@node1 ~]# rpm -qa|grep boost
boost-thread-1.53.0-25.el7.x86_64
boost-system-1.53.0-25.el7.x86_64
[root@node1 ~]# rpm -e --nodeps boost-thread-1.53.0-25.el7.x86_64
[root@node1 ~]# rpm -e --nodeps boost-system-1.53.0-25.el7.x86_64
[root@node1 ~]# rpm -qa| grep boost
[root@node1 ~]#
2、查看是否存在mysql用戶及組
[root@node1 boost]# cat /etc/group | grep mysql
[root@node1 boost]# cat /etc/passwd | grep mysql
[root@node1 boost]#
3、創(chuàng)建mysql用戶和組
[root@node1 boost]# groupadd mysql
[root@node1 boost]# useradd -r -g mysql mysql
[root@node1 boost]#
4、創(chuàng)建mysql安裝目錄
[root@node1 boost]# mkdir /usr/local/mysql
[root@node1 boost]# mkdir /usr/local/mysql/data
[root@node1 boost]#
5、安裝編譯軟件
yum -y install make gcc-c++ cmake libaio libaio-devel perl-Data-Dumper net-tools ncurses-devel bison bison-devel gcc-c++ ncurses-devel cmake perl gcc autoconf automake zlib libxml libgcrypt libtool
6、安裝lrzsz,使用lrzsz上傳MySql壓縮包
[root@node1 ~]# yum install lrzsz
[root@node1 ~]# rz
上傳MySql壓縮包
7、解壓MySql數(shù)據(jù)包
[root@node1 ~]# tar zxvf mysql-boost-5.7.13.tar.gz
8、cmake
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/root/mysql-5.7.13/boost/ -DWITH_SYSTEMD=1
9、make
make -j 6 \\指定幾個線程處理
10、make install \\安裝到指定目錄
11、更改mysql目錄權(quán)限
[root@node1 boost]# chown -R mysql:mysql /usr/local/mysql/
12、把mysql的執(zhí)行路徑加入PATH中
[root@node1 mysql-5.7.13]# vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin \\把此行加入到最后一行
[root@node1 mysql-5.7.13]# source /etc/profile
13、cp配置文件
# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
14、修改/etc/my.cnf
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
server_id = 1
socket = /usr/local/mysql/data/mysql.sock
log-error = /usr/local/mysql/data/mysql.err
15、配置并修改mysqld.service文件
[root@node1 mysql-5.7.13]# cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/
[root@node1 mysql-5.7.13]#
vi /usr/lib/systemd/system/mysqld.service
PIDFile=/usr/local/mysql/data/mysqld.pid \\修改成對應路徑
--pid-file=/usr/local/mysql/data/mysqld.pid \\修改成對應路徑
[root@node1 ~]# systemctl daemon-reload
16、初始化數(shù)據(jù)庫
[root@node1 ~]#/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
17、啟動mysql進程
[root@node1 ~]# systemctl start mysqld
18、登錄MySql數(shù)據(jù)庫
[root@node1 system]# /usr/local/mysql/bin/mysql -u root
19、修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root@123';
20、遠程登錄權(quán)限
GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'root@123';
FLUSH PRIVILEGES;
21、配置mysql自啟動
[root@node1 ~]# systemctl enable mysqld
22、為mysql開啟防火墻
firewall-cmd --permanent --zone=public --add-port=3306/tcp
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。