1、卸载系统自带的Mysql或mariadb及boost[root@node1 ~]# rpm -qa|grep mysql[root@node1 ~]# rpm -qa|grep mariadbmaria
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
--结束END--
本文标题: RHEL7.2编译安装mysql5.7.13
本文链接: https://lsjlt.com/news/43434.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0