官方网站中下载源码包;

https://dev.mysql.com/downloads/mysql/

选择下载源码包:

由于官网下载较慢,我选择使用搜狐镜像站进项下载..速度真的快的不是一星半点:

电梯:

http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17.tar.gz

下载下来后计算一下md5和上图比对一下.不对就重新下载一次.不过一般都没有什么问题.

创建用户:

 # useradd  -s /sbin/nologin mysql

安装cmake

 # tar zxf cmake-2.8.12.2.tar.gz
# cd cmake-2.8.12.2
# ./bootstrap --prefix=/usr/local/cmake
# make && make install # echo 'export PATH=$PATH:/usr/local/cmake/bin' >> /etc/profile
# source /etc/profile

下载Boost源码

根据官方文档提示,此过程比较消耗内存,同时也一定注意,从MySQL5.7版本开始,安装MySQL需要依赖 Boost  的C++扩展,而且只能是 1.59.0 版本;

Boost 下载地址: http://www.boost.org/users/history  ;选择1.59.0版本下载,在编译是填写相应参数,指定Boost源码位置即可;

# wget https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
# tar zxf boost_1_59_0.tar.gz
# mv boost_1_59_0 /usr/local/boots

编译安装mysql

# cd mysql-5.7.
# bpath='/opt/mysql/mysql_5717'
# cmake . \
-DCMAKE_INSTALL_PREFIX=${bpath} \
-DINSTALL_MYSQLDATADIR="${bpath}/var" \
-DMYSQL_DATADIR=${bpath}/var \
-DSYSCONFDIR=${bpath}/etc \
-DWITH_INNOBASE_STORAGE_ENGINE= \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_TCP_PORT=$bport \
-DMYSQL_UNIX_ADDR=${bpath}/tmp/mysql.sock \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_BOOST=/usr/local/boots \
-DDOWNLOAD_BOOST= # make && make install
# cd /opt/mysql/mysql_5717/
# mkdir {etc,log,tmp,var}
# chown mysql.mysql -R *

配置文件

 [mysql]
port=
default_character_set=utf8
no_auto_rehash [client]
port =
socket = /opt/mysql/mysql_5717/tmp/mysql.sock
loose_default_character_set = utf8 [mysqld]
####dir
pid-file = /opt/mysql/mysql_5717/tmp/mysql.pid
socket = /opt/mysql/mysql_5717/tmp/mysql.sock
datadir = /opt/mysql/mysql_5717/data
tmpdir = /tmp ####server
server_id =
port=
max_connections=
max_user_connections=
character_set_server=utf8
default_time_zone = '+08:00'
secure_file_priv = NULL
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
log_timestamps=system
transaction_write_set_extraction=MURMUR32
show_compatibility_56=on default_storage_engine=INNODB
lower_case_table_names=
auto_increment_increment =
auto_increment_offset =
log_bin_trust_function_creators=
explicit_defaults_for_timestamp= skip_external_locking
skip_name_resolve
wait_timeout=
interactive_timeout=
max_connect_errors=
open_files_limit=
connect_timeout=
net_read_timeout=
net_write_timeout=
back_log= ####slow log
long_query_time=
slow_query_log=
log_queries_not_using_indexes =
log_throttle_queries_not_using_indexes =
log_slow_admin_statements =
log_slow_slave_statements =
slow_query_log_file=/opt/mysql/mysql_5717/log/slowquery.log ####general log
general_log=
general_log_file=/opt/mysql/mysql_5717/log/general.log ####error log
log_error=/opt/mysql/mysql_5717/log/mysql.err ####query cache
query_cache_type=
query_cache_size=
query_cache_limit=2M
query_cache_min_res_unit=1K table_open_cache =
max_allowed_packet=32M
max_heap_table_size = 100M
tmp_table_size = 64M
thread_stack=512K
thread_cache_size=
read_rnd_buffer_size = 32M
sort_buffer_size = 32M
read_buffer_size = 32M
join_buffer_size = 128M ####innodb
innodb_data_home_dir=/opt/mysql/mysql_5717/data
innodb_log_group_home_dir=/opt/mysql/mysql_5717/data
innodb_data_file_path=ibdata1:2G;ibdata2:16M:autoextend
innodb_buffer_pool_size=4G
innodb_buffer_pool_instances=
innodb_log_files_in_group=
innodb_log_file_size=1024M
innodb_log_buffer_size=10M
innodb_flush_log_at_trx_commit=
innodb_max_dirty_pages_pct=
innodb_thread_concurrency=
innodb_read_io_threads=
innodb_write_io_threads=
innodb_open_files=
innodb_file_per_table=
innodb_flush_method=O_DIRECT
innodb_support_xa =
innodb_lock_wait_timeout=
innodb_page_size =
innodb_buffer_pool_load_at_startup =
innodb_buffer_pool_dump_at_shutdown =
innodb_buffer_pool_dump_pct =
innodb_page_cleaners =
innodb_lock_wait_timeout =
innodb_undo_directory = /opt/mysql/mysql_5717/data/
innodb_undo_logs =
innodb_undo_tablespaces =
innodb_undo_log_truncate =
innodb_max_undo_log_size = 2G
innodb_purge_rseg_truncate_frequency =
innodb_flush_neighbors = ####myisam
key_buffer_size = 64M
myisam_sort_buffer_size=64M ####gtid
gtid_mode=off
enforce_gtid_consistency= ####binlog
log_bin = mysql-bin
binlog_cache_size=4M
max_binlog_cache_size=2G
max_binlog_size=500M
binlog_format=ROW
#binlog_row_image=full
sync_binlog=
log_slave_updates=
expire_logs_days= ####replication
relay_log_recovery=
relay_log_purge =
relay_log= relaylog
read_only =
skip_slave_start
slave_net_timeout=
#slave_parallel_workers =
#master_info_repository = TABLE
#relay_log_info_repository = TABLE
#binlog_gtid_simple_recovery =
#slave_skip_errors = ddl_exist_errors [mysqldump]
quick
max_allowed_packet = 32M [myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M [mysqlhotcopy]
interactive_timeout

my.cnf

附上my.cnf,此文件存在$bpath/etc/下.

因此要把/etc/my.cnf删除.否则默认读/etc/my.cnf

配置文件中的参数不是通用.需要配合环境调整.

初始化mysql,mysql的初始密码存在mysql.err里

 创建安装目录和数据存放目录,并修改权限
# bin/mysqld --defaults-file=etc/my.cnf --initialize --user=mysql
# cat /opt/mysql/mysql_5717/log/mysql.err |grep 'A temporary password '
--28T15::58.385432+: [Note] A temporary password is generated for root@localhost: /0sgQgr3ADg* 这个是临时密码..一定要记住.

启动mysql

 cd $bpath
cp support-files/mysql.server /etc/init.d/mysqld
./bin/mysql.server restart 也可以把mysql.server拷贝到/etc/init.d下 使用service来启动
cp support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start

登录并修改密码:

 # ./bin/mysql  -u root -p 

 修改root密码,否则无法操作
mysql> ALTER USER root@localhost IDENTIFIED BY ''";

linux mysql 5.7.17 编译安装小记的更多相关文章

  1. mysql-5.6.17编译安装和常见问题

    mysql-5.6.17编译安装和常见问题 以前用的是MySQL的5.1版本,且使用的是免编译的包,安装简单.最近换了5.6版本的MySQL,安装过程出现了不少问题. 1. 卸载原来版本的MySQL ...

  2. Linux环境PostgreSQL源码编译安装

    Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...

  3. Windows(x86,64bit)升级MySQL 5.7.17免安装版的详细教程

    MySQL需要升级到5.5.3以上版本才支持Laravel 5.4默认的utf8mb64字符编码.因此就把MySQL升级了一下,期间还是遇到些小问题,记录一下以供参考. 升级准备 备份之前MySql目 ...

  4. linux下Mysql 8.0.19 编译安装

    1 前言 linux下安装MySQL的方式有很多种,包括以仓库的方式安装(yum,apt,zypper),以包的方式安装(rpm,deb),以docker方式安装,从压缩包解压安装,从源码编译安装,这 ...

  5. 【MySQL】源码编译安装和配置MySql 5.5.32(单实例)

    [需求描述] 在CentOS环境中,通过编译源码的方式,安装并且配置“单实例”的MySQL5.5.32数据库. MySQL的安装目录为:/application/mysql-5.5.32 MySQL数 ...

  6. [教程]centos卸载、安装mysql(源码编译安装方式)

    -----------1 卸载系统自带的msyql包 rpm -qa|grep mysql rpm -e --nodeps mysql-server-5.1.71-1.el6.x86_64 --强制卸 ...

  7. Linux下通过源码编译安装程序

    本文简单的记录了下,在linux下如何通过源码安装程序,以及相关的知识.(大神勿喷^_^) 一.程序的组成部分 Linux下程序大都是由以下几部分组成: 二进制文件:也就是可以运行的程序文件 库文件: ...

  8. CentOS下MySQL 5.7.9编译安装

    MySQL 5.7 GA版本的发布,也就是说从现在开始5.7已经可以在生产环境中使用,有任何问题官方都将立刻修复. MySQL 5.7主要特性: 更好的性能:对于多核CPU.固态硬盘.锁有着更好的优化 ...

  9. Linux下用Intel编译器编译安装NetCDF-Fortan库(4.2以后版本)

    本来这个问题真的没必要写的,可是真的困扰我太久%>_<%,决定还是记录一下. 首先,最权威清晰的安装文档还是官方的: Building the NetCDF-4.2 and later F ...

随机推荐

  1. [Android]--RadioGroup+RadioButton实现底部导航栏

    RadioGroup+RadioButton组合方式打造简单实用的底部导航栏 代码块: <?xml version="1.0" encoding="utf-8&qu ...

  2. 如何让Adobe reader 记住上次pdf文档打开位置?

    菜单栏: Edit --> Preferences --> Documents --> 勾选 “Restore last view settings where reopening ...

  3. SublimeText3插件Emmet自定义HTML

    工作上总使用Sublime,Emmet默认生成html格式不太满足需要,生成后还需要额外添加一些元素,如下是自定义html格式的步骤,供大家参考: 1. 安装Sublime Text3.Emmet插件 ...

  4. 【MyEcplise】导入项目后,会定时弹出一下错误MyEcplise tern was unable to complete your request in time.This couble happen if your project contains several large javaScript libraies.

    Myecplise弹出错误如下: 错误代码: MyEcplise tern was unable to complete your request in time.This couble happen ...

  5. C++中的模板学习

    https://www.cnblogs.com/eleclsc/p/5918114.html

  6. Ubuntu Tomcat

    启动80端口: 修改server.xml  Connector port=80 修改/etc/default/tomcat  AUTHBIND=yes 查看/etc/authbind/byport/下 ...

  7. More is better——并查集求最大集合(王道)

    Description Mr Wang wants some boys to help him with a project. Because the project is rather comple ...

  8. Web应用——驾培管理系统之个人管理(作者:小圣)

    Web应用--驾培管理系统之个人管理(作者:小圣) 本节博文旨在实现本次Web应用的个人管理功能.能够在登陆后 查看并改动个人信息或者进行password改动.同一时候,在输入的时候进行表单验证,验证 ...

  9. cocos2d-之音乐背景播放

    1.先加入头文件 #include <SimpleAudioEngine.h> using namespace CocosDenshion;//为了方便以下的函数使用,使用命名空间 2.在 ...

  10. 持续集成之代码质量管理-Sonar

    原文:http://blog.csdn.net/abcdocker/article/details/53840582 Sonar介绍 Sonar 是一个用于代码质量管理的开放平台.通过插件机制,Son ...