您好,登錄后才能下訂單哦!
1、卸載系統自帶的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、創建mysql用戶和組
[root@node1 boost]# groupadd mysql
[root@node1 boost]# useradd -r -g mysql mysql
[root@node1 boost]#
4、創建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數據包
[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目錄權限
[root@node1 boost]# chown -R mysql:mysql /usr/local/mysql/
12、把mysql的執行路徑加入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、初始化數據庫
[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數據庫
[root@node1 system]# /usr/local/mysql/bin/mysql -u root
19、修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root@123';
20、遠程登錄權限
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。