mysql5.7.9 源码安装 (转)
1,安装所有包
yum -y install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool bison python-devel
2,创建用户,目录,权限
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
mkdir /usr/local/mysql 软件目录
mkdir -p /usr/local/mysql/data 数据目录
mkdir -p /var/log/mysql 日志路径
mkdir -p /var/run/mysql pid路径
-- 用户属主
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /mydata/mysql/data
chown -R mysql:mysql /var/log/mysql
chown -R mysql:mysql /var/run/mysql
另外如果有登陆固需求:
设置vim /etc/security/limits.conf
mysql soft nproc 2047
mysql hard nproc 16384
mysql soft nofile 1024
mysql hard nofile 65536
环境变量:
vim /home/mysql/.bash_profile
export LANG=zh_CN.GB18030
export PATH=/usr/local/mysql/bin:$PATH
3,安装一些配置,工具包
gmock ,地址http://git.typecodes.com/libs/ccpp/gmock-1.6.0.zip
安装步骤,解压到mysql-5.7.9的source_downloads目录,可选步骤
安装cmake,可以使用yum安装或者下载安装,下载路经http://git.typecodes.com/libs/ccpp/cmake-3.2.1.tar.gz
安装ncurses-devel,yum安装
GNU分析器生成器,连接http://git.typecodes.com/libs/ccpp/bison-3.0.tar.gz
boost请看第四部分析
4,编译&&安装
tar zxvf mysql-5.7.9.tar.gz
cd mysql-5.7.9
第一部:cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/mydata/mysql/data -DSYSCONFDIR=/etc -DMYSQL_USER=mysql
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock -DMYSQL_TCP_PORT=3306
-DENABLED_LOCAL_INFILE=1 -DENABLE_DOWNLOADS=1
-DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
-DWITH_DEBUG=0 -DMYSQL_MAINTAINER_MODE=0
-DWITH_SSL:STRING=bundled -DWITH_ZLIB:STRING=bundled
-DWITH_BOOST=/usr/local/boost
第二部:make && make install
说明
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ [MySQL安装的根目录]
-DMYSQL_DATADIR=/mydata/mysql/data \ [MySQL数据库文件存放目录]
-DSYSCONFDIR=/etc \ [MySQL配置文件所在目录]
-DMYSQL_USER=mysql \ [MySQL用户名]
-DWITH_MYISAM_STORAGE_ENGINE=1 \ [MySQL的数据库引擎]
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ [MySQL的数据库引擎]
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ [MySQL的数据库引擎]
-DWITH_MEMORY_STORAGE_ENGINE=1 \ [MySQL的数据库引擎]
-DWITH_READLINE=1 \ [MySQL的readline library]
-DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock \ [MySQL的通讯目录]
-DMYSQL_TCP_PORT=3306 \ [MySQL的监听端口]
-DENABLED_LOCAL_INFILE=1 \ [启用加载本地数据]
-DENABLE_DOWNLOADS=1 \ [编译时允许自主下载相关文件]
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \ [使MySQL支持所有的扩展字符]
-DDEFAULT_CHARSET=utf8 \ [设置默认字符集为utf8]
-DDEFAULT_COLLATION=utf8_general_ci \ [设置默认字符校对]
-DWITH_DEBUG=0 \ [禁用调试模式]
-DMYSQL_MAINTAINER_MODE=0 \
-DWITH_SSL:STRING=bundled \ [通讯时支持ssl协议]
-DWITH_ZLIB:STRING=bundled \ [允许使用zlib library]
-DWITH_BOOST=/usr/local/boost [boost库地址,如果安装了,可以不用指定]
中间遇到两个问题,
第一,CMake Error at cmake/boost.cmake:76 (MESSAGE)
You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
解决方法:追加编译选项-DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost或者将
http://sourceforge.net/projects/boost/files/boost/1.59.0
/boost_1_59_0.tar.gz下载到/usr/local/boost
再追加编译选项-DWITH_BOOST=/usr/local/boost
这个一定要匹配,mysql-5.7.9可能需要安装boost_1_59_0以上版本的
第二,Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
解决:
rm CMakeCache.txt
yum install ncurses-devel
其实这个根据提示就可以看出来了
第三,安装boost的时候,提示很多python库没找到
yum install python-devel
5,配置文件
我们安装时配置的路径是etc,这里有个默认的文件my.cnf,修改内容为类似如下
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
port=3306
socket=/var/run/mysql/mysql.sock
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
user = mysql
basedir = /usr/local/mysql
datadir = /mydata/mysql/data
port=3306
server-id = 1
socket=/var/run/mysql/mysql.sock
character-set-server = utf8
log-error = /var/log/mysql/error.log
pid-file = /var/log/mysql/mysql.pid
general_log = 1
skip-name-resolve
#skip-networking
back_log = 300
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 28M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30
performance_schema = 0
explicit_defaults_for_timestamp
#lower_case_table_names = 1
#default-storage-engine=myism
#innodb_buffer_pool_size=2048M
#innodb_log_file_size=1024M
myisam_sort_buffer_size = 8M
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,STRICT_TRANS_TABLES
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M
6,初始化数据库
/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/mysql/data
这部很重要,如果初始库不能创建,服务是岂不来的
7,设置系统服务,开机子启动
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysql
chkconfig mysqld on
8,启动服务
mysqld_safe --user=mysql --datadir=/mydata/mysql/data --log-error=/var/log/mysql/error.log &
service mysqld start
不懂两者关系摆渡
查看启动情况:ps -ef | grep mysql,netstat -tunpl | grep 3306
9,初始化配置
mysql_secure_installation
根据需要配置一些root密码,是否匿名访问,是否远程访问,删除test库等操作
10,创建用户等
mysql -uroot -p
create database `mysqldb` default character set utf8 collate utf8_general_ci;
grant all privileges on mysqldb.* to loge0001@localhost identified by 'china123';
flush privileges;
说明:mysql比较特殊,不像oracle,授权即可创建新用户
mysql5.7.9 源码安装 (转)的更多相关文章
- mysql-5.5.28源码安装过程中错误总结
介绍一下关于mysql-5.5.28源码安装过程中几大错误总结,希望此文章对各位同学有所帮助.系统centOS 6.3 mini (没有任何编译环境)预编译环境首先装了众所周知的 cmake(yum ...
- mysql-5.7.25 源码 安装
mysql-5.7.25 源码 安装 编译 export INSTALL_PREFIX="/data/services" export MYSQL_INSTALL_PATH=&qu ...
- MySQL5.7.20源码安装以及pt-query-digest用法示例
MySQL5.7.20源码安装1.下载解压cd /data/app/mysql5.7wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5 ...
- RHEL Server 6.3下MySQL5.5.25a源码安装
OS:RHEL Server 6.3 MySQL:mysql-5.5.25a.tar.gz 相关依赖包: ncurses-5.9.tar.gz bison-2.5.tar.gz 安装MySQL 一.安 ...
- mysql5.7.17源码安装
创建用户和目录 groupadd mysql useradd -r -g mysql mysql mkdir -p /data/mysql/standby/data mkdir -p /data/my ...
- CentOS 6.5 MySQL5.6.26源码安装
一.源码安装cmake工具 从mysql5.5起,mysql源码安装开始使用cmake wget http://cmake.org/files/v3.2/cmake-3.2.3.tar.gztar z ...
- mysql5.5.30源码安装及主从搭建
双机热备(实验环境) 主服务器:ip地址192.168.100.244,mysql版本5.5.30,源码安装 从服务器:ip地址192.168.100.245 一.源码安装mysql5.5 启动目录: ...
- mysql5.6.35源码安装记录
mysql数据库源码安装: 源码地址:wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.xx.tar.gz #安装前准备, ...
- mysql-5.7.14 源码安装笔记
安装编译 下载源码 mysql-5.7.14.tar.gz 解压定义安装变量 cd /usr/local/src mysql_version="mysql-5.7.14" tar ...
- MySQL5.6 linux源码安装
安装mysql 创建mysql数据目录 mkdir -p /usr/local/mysql --安装目录 mkdir -p /mysql/data ---数据目录 mkdir -p /mysql/lo ...
随机推荐
- Asp登陆
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QYLogin.aspx.c ...
- [转载]Magento 店铺多语言设置
本文以扩展中文包为例: 首先进入自己 Magento 后台 系统 -> 管理商店(System -> Manage Stores) 单击 “创建店铺视图”(Create Store Vie ...
- 第二个Sprint冲刺第一天
讨论地点:宿舍 讨论成员:邵家文.李新.朱浩龙.陈俊金 任务:第二次sprint前期把选择题的计时功能完成. 燃尽图: 开发感悟: 大三第一学期就快结束了,大家都为未来找工作而烦恼.班里的高手都去学校 ...
- ASP.NET定制简单的错误处理页面
通常Web应用程序在发布后,为了给用户一个友好界面和使用体验,都会在错误发生时跳转至一个自定义的错误页面,而不是ASP.net向用户暴露出来的详细的异常列表. 简单的错误处理页面可以通过web.con ...
- E - Power Strings,求最小周期串
E - Power Strings Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u S ...
- mapreduce入门之wordcount注释详解
mapreduce版本:0.2.0之前 说明: 该注释为之前学习时找到的一篇,现在只是在入门以后对该注释做了一些修正以及添加. 由于版本问题,该代码并没有在集群环境中运行,只将其做为理解mapredu ...
- Install GD on mac
Lots of bioinformatics software are based on perl. Some of them, for example, Circos, NGS toolkit... ...
- UI学习笔记---第七天
UIScrollView 滚动视图 UIScrollView的常用属性 iPone屏幕大小限制了内容的显示,UIScrollView 类提供了屏幕滚动功能 UIScrollView是所有滑动视图的 ...
- ZMMR104-预留单批量删除及恢复
************************************************************************ Title : ZMMR104 ** Applicat ...
- Js 操作Json
JSON是一个提供了stringify和parse方法的内置对象,前者用于将js对象转化为符合json标准的字符串,后者将符合json标准的字符串转化为js对象. parse方法相当于eval()方法 ...