centos7.2环境编译安装mysql5.5.48 [转 ]

一.安装cmake编译工具

跨平台编译器
查看是否已经安装了gcc

# rpm -qa | grep gcc

# yum install -y gcc-c++
# yum install -y cmake
# yum install -y git
解决依赖关系
# yum install -y readline-devel zlib-devel openssl-devel

Warning: Bison executable not found in PATH
 
解决方法:
#  yum install -y bison
再次编译即通过

二、编译安装mysql-5.5.48

# tar xf mysql-5.5.48.tar.gz
# cd mysql-5.5.48
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mydata -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

# make && make install

编译报错需要删除编译缓存
rm CMakeCache.txt

编译报错:

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Looking for getpagesize - not found
-- Looking for TIOCGWINSZ
CMake Error at /usr/share/cmake/Modules/CMakeCInformation.cmake:37 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:3 (PROJECT)

安装gcc-c++即可

cmake . -- Running cmake version 2.8.10.2 -- Could NOT find Git (missing: GIT_EXECUTABLE) -- Configuring with MAX_INDEXES = 64U -- Looking for SHM_HUGETLB -- Looking for SHM_HUGETLB - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of void * -- Check size of void * - done -- SIZEOF_VOIDP 8 -- MySQL 5.7.9 -- Packaging as: mysql-5.7.9-Linux-x86_64 -- Looked for boost/version.hpp in and -- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND -- LOCAL_BOOST_DIR -- LOCAL_BOOST_ZIP -- Could not find (the correct version of) boost. -- MySQL currently requires boost_1_59_0 CMake Error at cmake/boost.cmake:76 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST= This CMake script will look for boost in . If it is not there, it will download and unpack it (in that directory) for you. If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80 Call Stack (most recent call first): cmake/boost.cmake:228 (COULD_NOT_FIND_BOOST) CMakeLists.txt:435 (INCLUDE) -- Configuring incomplete, errors occurred!

安装git即可

三、新建存放Mysql数据库文件的逻辑卷并挂载到/data/mydata下

分区
# fdisk /dev/sda
n
p
3
+20G
w

#挂载系统分区
# kpartx -l /dev/sda
# kpartx -af /dev/sda
# partx -a /dev/sda
验证是否挂载成功
# cat /proc/partitions
创建物理卷
# pvcreate /dev/sda3
创建名为myvg的卷组
# vgcreate myvg /dev/sda3
#创建一个大小为15G,名字叫做mylv的逻辑卷
# lvcreate -L 15G -n mylv myvg
格式化
# mke2fs -t ext4 -b 2048 /dev/myvg/mylv

# mkdir -pv /data/mydata
mkdir: created directory ‘/data’
mkdir: created directory ‘/data/mydata’
# mount /dev/myvg/mylv /data/mydata
# vim /etc/fstab
添加如下内容:
/dev/myvg/mylv /data/mydataext4defaults,noatime 0 0

四、创建Mysql用户

添加mysql用户指定组id和用户id为306
# groupadd -r -g 306 mysql
# useradd -g mysql -r -g 306 -s /sbin/nologin mysql
# id mysql
uid=994(mysql) gid=306(mysql) groups=306(mysql)

改变数据存储目录和安装目录的权限
# cd /usr/local/mysql
添加存放日志的目录
# mkdir /data/binlogs
# chown -R :mysql ./*
# chown -R mysql.mysql /data/mydata

五、启动脚本初始化数据库

# scripts/mysql_install_db --user=mysql --datadir=/data/mydata
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# cp support-files/my-large.cnf /etc/my.cnf

编辑/etc/my.cnf配置,加入以下内容

innodb_file_per_table = ON

datadir = /data/mydata

log-bin=/data/binlogs/mysql-bin

注意:

经过实际测试innodb_file_per_table = ON这条参数需要innodb_file_per_table = 1 才能生效,具体可以通过

mysql> show variables like ‘%per_table%‘;来查询

把mysqld服务加入到启动项
# chkconfig --add mysqld
# chkconfig --list mysqld

将mysql命令加入环境变量中
vim /etc/profile.d/mysql.sh
加入
export PATH=/usr/local/mysql/bin:$PATH

启动mysqld服务
# service mysqld start
报错
Starting MySQL. ERROR! The server quit without updating PID file (/data/mydata/oadb-test.pid).
# ss -tnl

可以观察日志/data/mydata/oadb-test.err,是日志创建权限的问题
# chown -R mysql.mysql /data

六、上传通达OA数据库并配置相关权限

上传通达OA数据库到服务器上,修改权限,并重启服务,测试

# chown -R mysql.mysql /data/mydata
# service mysqld restart

对mysql数据库用户进行清理,加密码

mysql> use mysql
Database changed
mysql> select user,host,password from user;
+------+-----------+----------+
| user | host      | password |
+------+-----------+----------+
| root | localhost |          |
| root | adb-test  |          |
| root | 127.0.0.1 |          |
| root | ::1       |          |
|      | localhost |          |
|      | adb-test  |          |
+------+-----------+----------+
6 rows in set (0.01 sec)

mysql> delete from user where user=‘‘ and host=‘localhost‘;
Query OK, 1 row affected (0.01 sec)

mysql> delete from user where user=‘‘ and host=‘adb-test‘;
Query OK, 1 row affected (0.00 sec)

设置其中root密码为myoa888,并对服务器IP限制
mysql> update user set password=PASSWORD(‘myoa888‘),host=‘192.168.11.144‘ where user=‘root‘ and host=‘::1‘;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

对root用户加密

mysql> update user set password=PASSWORD(‘13C1325E831DEC8D60‘) where user=‘root‘ and host in(‘localhost‘,‘adb-test‘,‘127.0.0.1‘);
mysql> select user,host,password from user;
+------+----------------+-------------------------------------------+
| user | host           | password                                  |
+------+----------------+-------------------------------------------+
| root | localhost      | *CF51F9E245F41378E51B4154082F26108A5B0D63 |
| root | adb-test       | *CF51F9E245F41378E51B4154082F26108A5B0D63 |
| root | 127.0.0.1      | *CF51F9E245F41378E51B4154082F26108A5B0D63 |
| root | 192.168.11.144 | *91AF99F23C3D4ED85140D100433725DFA52BECEE |
+------+----------------+-------------------------------------------+

centos7关闭防火墙命令# systemctl stop firewalld.service

systemctl start firewalld.service#启动firewallsystemctl disable firewalld.service#禁止firewall开机启动

原文地址:https://www.cnblogs.com/sushuangming/p/9249050.html

时间: 2024-10-09 17:55:11

centos7.2环境编译安装mysql5.5.48 [转 ]的相关文章

在CentOS7中手工编译安装Mysql5.7

在CentOS7中手工编译安装Mysql5.7 实验介绍:由于Mysql自从5.5之后,都需要安装boost的函数库,所以和LAMP中编译安装Mysql略有不同,配置文件也不一样,下面来介绍. 1.首先查看CentOS7之前是否安装过Mysql,先要进行删除,使用的命令是. rpm -q mysql 2.首先使用yum仓库安装所需要的开发包和软件包. yum -y install ncurses \ #提供字符终端处理库 ncurses-devel \ #ncurses开发包 bison \ #

Centos7.4 版本环境下安装Mysql5.7操作记录

Centos7.x版本下针对Mysql的安装和使用多少跟之前的Centos6之前版本有所不同的,废话就不多赘述了,下面介绍下在centos7.x环境里安装mysql5.7的几种方法: 一.yum方式安装 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 5

centos7编译安装mysql5.7.20版本

centos7编译安装mysql5.7.20版本 遇到问题: 之前想在线上搭建mysql5.7.20版本找了很多文档都觉得写得不怎么完善,很多需要注意的错误点都提及,所以只好自己写一篇了!个人觉得最主要注意的是mysql的data目录一定不能漏了权限问题,还有的经常遇到mysql.sock文件的错误就是因为编译的时候指定的目录要小心,然后启动前在my.cnf文件里面定义一下问题就解决了.这是我写的时候遇到最多的问题. 一.进入mysql官网下载(www.mysql.org)mysql源安装包:

开发人员学Linux(6):CentOS7编译安装MySQL5.17.8多实例及主从复制

1.前言上一篇讲述了如何在CentOS7下编译安装Nginx-1.12.0并如何配置反向代理,本篇将讲述如何编译安装MySQL5.7.18并配置多实例.2.准备2.1下载MySQL5.7.18源码注意最新版本的MySQL需要Boost才能编译安装,在MySQL提供的下载中有不带boost的源码,还有带boost的源码,如果下载不带boost的源码还需要再去下载boost源码,为省事起见,建议下载带boost的源码,下载地址:https://cdn.mysql.com//Downloads/MyS

CentOS7 编译安装MySQL5.6.38

1. 下载MySQL5.6.38安装包 下载地址:https://www.mysql.com/downloads/  打开网站之后选择Archives 然后再选择开源版本 选择我们要下载的版本 2. 编译安装MySQL5.6.38 # cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # 创建系统帐号 # groupadd -r mysql # useradd -r -g mysql -s /sbin/nologin mys

三、编译安装mysql-5.5.33

三.编译安装mysql-5.5.33 1.准备数据存放的文件系统: 新建一个逻辑卷(过程见链接),并将其挂载至/mydata/data目录, 做为mysql数据的存放目录. http://858004880.blog.51cto.com/7265424/1759317 2.新建用户以安全方式运行进程: 1.删除系统原来的mysql用户家目录 [[email protected] ~]# userdel -r mysql 2.创建mysql系统用户组 [[email protected] ~]# 

在centos-6.3中安装mysql-5.5.48

采用源码编译方式在centos-6.3中安装mysql-5.5.48,编译器使用cmake. 软件包:mysql-5.5.48.tar.gz和cmake-2.8.10.2.tar.gz 软件包下载地址: http://mysql.mirror.kangaroot.net/Downloads/ 或 http://pan.baidu.com/s/1pLKOC0z http://www.cmake.org/files 或 http://pan.baidu.com/s/1slSmhAX 步骤: 1.将m

cmake编译安装mysql5.5

CMAKE方式编译安装Mysql5.5 1.源码cmake方式编译安装MySQL5.5.32 安装前先安装: yum install ncurses-devel -y 1.1 下载Mysql和cmake安装包: wget http://wwwNaNake.org/files/v2.8/cmake-2.8.8.tar.gz 1.2 查看系统环境 cat /etc/redhat-release uname -r uname -m 1.3 安装cmake包 tar zxf cmake-2.8.8.ta

编译安装MySQL-5.7.13

编译安装MySQL-5.7 cmake的重要特性之一是其独立于源码(out-of-source)的编译功能,即编译工作可以在另一个指定的目录中而非源码目录中进行,这可以保证源码目录不受任何一次编译的影响,因此在同一个源码树上可以进行多次不同的编译,如针对于不同平台编译. 编译安装MySQL-5.7 +++++++++++++++++++++++++OS:centos7 & 3.10.0-327.el7.x86_64MySQL:mysql-boost-5.7.13.tar.gz++++++++++