## 说明 不同服务器需要改变 server_id ,同一台机器上需要改变 port

1. 关闭防火墙
[root@mysql ~]# service iptables status --查看防火墙状态
[root@mysql ~]# service iptables stop --关闭防火墙
[root@mysql ~]# chkconfig iptables off --永久关闭
[root@mysql ~]# vim /etc/sysconfig/selinux
SELINUX=disabled

2. 配置sysctl.conf
生产环境下建议根据情况配置,虚拟机安装可以不设置

3. 检查操作系统上是否已经安装了mysql,如果有进行卸载
[root@mysql yum.repos.d]# rpm -qa |grep mysql
[root@mysql yum.repos.d]# yum remove mysql

4. 下载mysql源码包
https://dev.mysql.com/downloads/file/?id=469012

5. 添加用户和组
[root@mysql u01]# userdel -r mysql --删除原先的mysql用户 -r会删掉附带的group
[root@mysql u01]# groupadd mysql
[root@mysql u01]# useradd -d /home/mysql -g mysql -m mysql
[root@mysql u01]# passwd mysql
Changing password for user mysql.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@mysql u01]# id mysql
uid=500(mysql) gid=500(mysql) groups=500(mysql)

6. 配置mysql环境变量
[mysql@mysql ~]$ vim .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/u01/my3306/bin

export PATH
[mysql@mysql ~]$ source .bash_profile

7. 创建目录及授权
[root@mysql u01]# cd /u01
[root@mysql u01]# mkdir -p /u01/my3306/data
[root@mysql u01]# mkdir -p /u01/my3306/log/iblog
[root@mysql u01]# mkdir -p /u01/my3306/log/binlog
[root@mysql u01]# mkdir -p /u01/my3306/run
[root@mysql u01]# mkdir -p /u01/my3306/tmp
[root@mysql u01]# chown -R mysql:mysql /u01/my3306
[root@mysql u01]# chmod 755 /u01/my3306

8. 解压mysql
[root@mysql u01]# tar -xzvf mysql-5.6.36.tar.gz

9. 配置yum源,安装cmakle及一些必备的包,要求2.6版本及以上
yum install -y cmake gcc gcc-c++ ncurses-devel bison zlib libxml openssl

10. 编译并安装
cmake \
-DCMAKE_INSTALL_PREFIX=/u01/my3306 \
-DINSTALL_DATADIR=/u01/my3306/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \ --
-DWITH_SSL=yes \ --安全套接字
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/u01/my3306/run/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DSYSCONFDIR=/etc \
-DWITH_READLINE=on

[root@mysql mysql-5.6.36]# cd mysql-5.6.36
[root@mysql mysql-5.6.36]# cmake -DCMAKE_INSTALL_PREFIX=/u01/my3306 -DINSTALL_DATADIR=/u01/my3306/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_SSL=yes -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/u01/my3306/run/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DSYSCONFDIR=/etc -DWITH_READLINE=on
[root@mysql mysql-5.6.36]# make
[root@mysql mysql-5.6.36]# make install

11. 配置mysql参数
[root@mysql my3306]# pwd
/u01/my3306
[root@mysql my3306]# cat my.cnf
[client]
port=3306
socket=/u01/my3306/mysql.sock

[mysql]
pid_file=/u01/my3306/run/mysqld.pid

[mysqld]
autocommit=1
general_log=off
explicit_defaults_for_timestamp=true

# system
basedir=/u01/my3306
datadir=/u01/my3306/data
max_allowed_packet=1g
max_connections=3000
max_user_connections=2800
open_files_limit=65535
pid_file=/u01/my3306/run/mysqld.pid
port=3306
server_id=101
skip_name_resolve=ON
socket=/u01/my3306/run/mysql.sock
tmpdir=/u01/my3306/tmp

#binlog
log_bin=/u01/my3306/log/binlog/binlog
binlog_cache_size=32768
binlog_format=row
expire_logs_days=7
log_slave_updates=ON
max_binlog_cache_size=2147483648
max_binlog_size=524288000
sync_binlog=100

#logging
log_error=/u01/my3306/log/error.log
slow_query_log_file=/u01/my3306/log/slow.log
log_queries_not_using_indexes=0
slow_query_log=1
log_slave_updates=ON
log_slow_admin_statements=1
long_query_time=1

#relay
relay_log=/u01/my3306/log/relaylog
relay_log_index=/u01/my3306/log/relay.index
relay_log_info_file=/u01/my3306/log/relay-log.info

#slave
slave_load_tmpdir=/u01/my3306/tmp
slave_skip_errors=OFF

#innodb
innodb_data_home_dir=/u01/my3306/log/iblog
innodb_log_group_home_dir=/u01/my3306/log/iblog
innodb_adaptive_flushing=ON
innodb_adaptive_hash_index=ON
innodb_autoinc_lock_mode=1
innodb_buffer_pool_instances=8

#default
innodb_change_buffering=inserts
innodb_checksums=ON
innodb_buffer_pool_size= 128M
innodb_data_file_path=ibdata1:32M;ibdata2:16M:autoextend
innodb_doublewrite=ON
innodb_file_format=Barracuda
innodb_file_per_table=ON
innodb_flush_log_at_trx_commit=1
innodb_flush_method=O_DIRECT
innodb_io_capacity=1000
innodb_lock_wait_timeout=10
innodb_log_buffer_size=67108864
innodb_log_file_size=1048576000
innodb_log_files_in_group=4
innodb_max_dirty_pages_pct=60
innodb_open_files=60000
innodb_purge_threads=1
innodb_read_io_threads=4
innodb_stats_on_metadata=OFF
innodb_support_xa=ON
innodb_use_native_aio=OFF
innodb_write_io_threads=10

[mysqld_safe]
[root@mysql my3306]# chown -R mysql:mysql /u01/my3306

12. 初始化mysql脚本
[root@mysql my3306]# ./scripts/mysql_install_db --defaults-file=/u01/my3306/my.cnf --datadir=/u01/my3306/data --user=mysql

13. 启动mysql
[mysql@mysql bin]$ ./mysqld_safe --defaults-file=/u01/my3306/my.cnf --user=mysql &
[1] 17237
[mysql@mysql bin]$ 170612 06:37:02 mysqld_safe Logging to '/u01/my3306/log/error.log'.
170612 06:37:02 mysqld_safe Starting mysqld daemon with databases from /u01/my3306/data

[mysql@mysql bin]$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.36-log Source distribution

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.10 sec)

Mysql5.6 for Centos6.5源码编译安装的更多相关文章

  1. CentOS6.8 x64+Nginx1.3.8/Apache-httpd 2.4.3+PHP5.4.8(php-fpm)+MySQL5.5.28+CoreSeek4.1源码编译安装

    系统为CentOS6.8 x64服务器版精简安装. 准备工作 部署安装目录 /usr/local/* /var/lib/* /var/lib64/* 下载源文件 #cd /usr/local/src ...

  2. Centos6.5 源码编译安装 Mysql5.7.11及配置

    安装环境 Linux(CentOS6.5 版).boost_1_59_0.tar.gz.mysql-5.7.11.tar.gzMySQL 5.7主要特性:    更好的性能:对于多核CPU.固态硬盘. ...

  3. Centos6.5源码编译安装nginx

    1.安装pcre下载地址:http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz #tar -axvf pcre ...

  4. centos6.5环境源码编译安装mysql5.6.34

    centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...

  5. mysql5.7.10 源码编译安装记录 (centos6.4)【转】

    一.准备工作 1.1 卸载系统自带mysql 查看系统是否自带MySQL, 如果有就卸载了, 卸载方式有两种yum, rpm, 这里通过yum卸载 rpm -qa | grep mysql //查看系 ...

  6. 烂泥:mysql5.5数据库cmake源码编译安装

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 以前也写过一篇有关mysql5.0源码编译的文章,该文章为<烂泥:mysql5.0数据库源码编译安装>.但是MySQL自5.5版本以后,就开 ...

  7. 源码编译安装mysql5.5.33

    源码编译安装mysql5.5.33 一.安装cmake编译工具 跨平台编译器 # yum install -y gcc* # yum install -y cmake 解决依赖关系 # yum ins ...

  8. CentOS7.5源码编译安装mysql5.7.29

    #查看系统版本 [root@ctos3 ~]# cat /etc/redhat-release CentOS Linux release (Core) #下载源码包,需要注意的是mysql5.7 编译 ...

  9. Mysql5.7.34 数据库源码编译安装

    Mysql 数据库源码编译安装 MySQL是一个关系型数据库管理系统,关系型数据库是将数据保存在不同的表中,而非将所有数据放在一个大仓库内,这样就加快了速度并提高了灵活性.由于其体积小.速度快.总体拥 ...

随机推荐

  1. matlab中diff的用法

    若是diff(),括号里的元素为向量,那么前一个减后一个即为diff后的结果: 若diff(),括号里的元素为矩阵,那么下一行减上一行即为diff 后的结果:

  2. 20165326 java第四周学习笔记

    第四周学习笔记 ch5 子类和父类 子类只能有一个父类 使用关键字extendsyclass 子类 extends 父类 系统默认的祖先类Object(java.lang包中) 继承:子类继承父类的方 ...

  3. css , dl , dt , dd 的使用. calc

    dl .dt, dd 虽然很少使用, 但是 有时使用会有 更好的效果: 一: 展示图片: ------------------------- 代码: <!DOCTYPE html> < ...

  4. ChinaCock界面控件介绍-CCNewsSilder

    上图是控件包里的Demo运行效果,轮播新闻图片. 这个控件用起来简单,拖放一个CCNewsSiler到Form上,设置Align为Top,再设置好高度,然后用代码加载图片: procedure TFo ...

  5. git 清空缓冲区

    git rm与git rm --cached 当我们需要删除暂存区或分支上的文件, 同时工作区也不需要这个文件了, 可以使用 git rm file_path git commit -m 'delet ...

  6. SpringdataJpa的官方API学习

    (将对Springdata JPA的API  第三章之后进行解释) 一 .  Core concepts(核心概念) 1.springdata中的中心接口是——Repository.这个接口没有什么重 ...

  7. 【opencv基础】图像的几何变换

    参考 1. 图像的几何变换-平移和镜像: 2.图像的几何变换-缩放和旋转: 3. opencv图像旋转实现: 完

  8. np.tile语法

    >>> v = np.array([1, 0, 1])>>> vv = np.tile(v,(4,1))>>> print vv[[1 0 1] ...

  9. NOI-1.1-10-字符表示超级玛丽

    10:超级玛丽游戏   总时间限制:  1000ms 内存限制:  65536kB 描述 超级玛丽是一个非常经典的游戏.请你用字符画的形式输出超级玛丽中的一个场景. 输入 无. 输出 如样例所示. 样 ...

  10. Orcal数据库12c安装完成后注意事项

    1.按照12c的安装使用装完数据库后,使用navicat链接orcal数据库时无法使用. 点击此处查看安装方案 2. 2048错误,ORA-28040: No matching authenticat ...