环境: centos 6.5  192.168.9.28  4核4G 虚拟机

一. 安装编译源码所需要的工具和库

[root@localhost ~]# yum -y install gcc gcc-c++ make ncurses-devel perl

[root@localhost soft]# ls
cmake-2.8.6.tar.gz  mysql-5.6.35.tar.gz

[root@localhost soft]# tar xf cmake-2.8.6.tar.gz -C /usr/src

[root@localhost soft]# cd /usr/src/cmake-2.8.6/
[root@localhost cmake-2.8.6]# ls
bootstrap                   cmake_uninstall.cmake.in  Docs
ChangeLog.manual            CompileFlags.cmake        doxygen.config
ChangeLog.txt               configure                 Example
cmake.1                     Copyright.txt             Modules
CMakeCPack.cmake            CTestConfig.cmake         Readme.txt
CMakeCPackOptions.cmake.in  CTestCustom.cmake.in      Source
CMakeGraphVizOptions.cmake  CTestCustom.ctest.in      Templates
CMakeLists.txt              DartConfig.cmake          Tests
CMakeLogo.gif               DartLocal.conf.in         Utilities
[root@localhost cmake-2.8.6]# ./bootstrap

[root@localhost cmake-2.8.6]# make && make install

二.设置mysql用户组和用户

[root@localhost cmake-2.8.6]# groupadd mysql

[root@localhost cmake-2.8.6]# useradd -r -g mysql mysql

三. 新建mysql 所需要的数据目录

[root@localhost cmake-2.8.6]# mkdir -p /usr/local/mysql
[root@localhost cmake-2.8.6]# mkdir -p /data/mysqldb

[root@localhost soft]# tar xf mysql-5.6.35.tar.gz -C /usr/src
[root@localhost soft]# cd /usr/src/mysql-5.6.35/

四.编译安装mysql

[root@localhost mysql-5.6.35]# cmake -DCMAK_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1

[root@localhost mysql-5.6.35]# make && make install

五.修改mysql目录的所有者和属组

[root@localhost mysql-5.6.35]# chown -R mysql.mysql /data/mysqldb/
[root@localhost mysql-5.6.35]# chown -R mysql.mysql /usr/local/mysql/

六. 导入mysql的配置文件,以下myql配置文件根据服务器的配置不同需要做出相应的更改。

也可以启动mysql时,根据错误日志内容做出相应的更改。

[root@localhost etc]# egrep -v "^$|^#" ./my.cnf

[mysqld]
datadir= /data/mysqldb
socket=/usr/local/mysql/mysql.sock
user=mysql
port = 3306
server_id = 11
autocommit = 0
character_set_server=utf8
max_allowed_packet = 52m
max-connections = 1000
interactive_timeout = 1800
wait_timeout = 1800
read_buffer_size = 16777216
read_rnd_buffer_size = 33554432
sort_buffer_size = 33554432
tmp_table_size = 67108864
tmpdir = /tmp
log-bin=mysql-bin
binlog-format = ROW
relay-log = mysql-relay-bin
log-slave-updates = 1
read_only = 0
sync_binlog = 1
plugin-load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
rpl-semi-sync-master-enabled = 1
rpl-semi-sync-slave-enabled = 1
slave-skip-errors = ddl_exist_errors
relay-log-info-repository = TABLE
relay_log_recovery = 1
master_info_repository = TABLE
log_error = error.log
slow_query_log = 1
slow_query_log_file = slow.log
log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 90
long_query_time = 2
min_examined_row_limit = 100
innodb_page_size = 16384
innodb_buffer_pool_size = 4G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 2000
innodb_lock_wait_timeout = 5
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_undo_logs = 128
innodb_undo_tablespaces = 3
innodb_flush_neighbors = 1
innodb_log_file_size = 4G
innodb_log_buffer_size = 16777216
innodb_purge_threads = 4
innodb_large_prefix = 1
innodb_thread_concurrency = 64
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_flush_log_at_trx_commit=1
innodb_sort_buffer_size = 67108864
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0

七. 初始化数据库

[root@localhost ~]# cd /usr/local/mysql/

[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb

八. 复制mysql启动脚本及加入PATH 路径

[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld

PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH

[root@localhost mysql]# source /etc/profile

九 启动myql 并加入开机自启动

[root@localhost mysql]# /etc/init.d/mysqld start

[root@localhost mysql]# netstat -lnpt | grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN      1361/mysqld

注:在启动mysql的时候,可能会遇到mysql 启动报错的问题,查看错误日志报:

Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
解决方法:重新执行 第七步,在重新启动mysql,错误日志继续报

[ERROR] Aborting,执行chown -R mysql:mysql /data/mysqldb/  
chown -R mysql:mysql /usr/local/mysql/ ,在启动mysql就可以了。
 
 

十.设置mysql 的root 密码

[root@localhost mysql]# mysqladmin -u root password '123456'
[root@localhost mysql]# mysql -uroot -p
Enter password: 输入123456

Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.35-log Source distribution

Copyright (c) 2000, 2016, 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 5.6 安装完毕

 

myql 5.6 安装的更多相关文章

  1. MYSQL数据库的安装,配置文件,登入

    07.13自我总结 MYSQL数据库 一.MYQL数据库的安装 可以去mysql官网下载mysql压缩包 运行程序:在bin文件夹中,其中客户端运行文件是mysql.exe,服务端运行文件为mysql ...

  2. LAMP架构上(一)

    第十七课LAMP架构上(一) 目录 一.LAMP架构介绍 二.MySQL.MariaDB介绍 三.MySQL安装 四.MariaDB安装 五.Apache安装 六.安装PHP5 七.安装PHP7 八. ...

  3. 使用docker安装myql/redis等软件

    使用docker安装myql/redis等软件 概述 基本命令 安装mysql 安装redis 概述 在开发时经常需要安装各种软件,有时甚至为了验证一个命令不得不安装配置一个缓存.数据库.MQ等,耽误 ...

  4. Linux 安装MySQL

    安装配置 [root@iZ28gvqe4biZ ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.r ...

  5. mysql5.6.23免安装配置

    1.官网下载,并解压 2.环境变量,path下,追加mysql的bin路径D:\Program Files\mysql\bin; 3.mysql目录下的my-default.ini重命名为my.ini ...

  6. Linux~centos上安装.netcore,HelloWorld归来!

    对于跨平台的.netCore来说,让它的程序运行在Linux系统上已经成为必然,也是一种趋势,毕竟我们的很多服务都放在linux服务器上(redis,mongodb,myql,fastDFS,luce ...

  7. redhat6.4上安装mysql

    1.挂载操作系统介质 [root@server- ~]# mkdir -p /media/dvd [root@server- ~]# -20130130.0-Server-x86_64-DVD1.is ...

  8. centos7安装mysql

    centos7安装mysql 1 查找系统是否安装了myql rpm -q mysql mysql-server1.1如果安装了.就删除 sudo yum -y remove mysql mysql- ...

  9. Linux(Ubuntu)下MySQL的安装与配置

    转自:http://www.2cto.com/database/201401/273423.html 在Linux下MySQL的安装,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕.今 ...

随机推荐

  1. 解决mysql 远程链接问题

    grant all privileges on *.* to 'root'@'192.168.2.204' identified by '123456' with grant option;flush ...

  2. nfc是什么?nfc功能是什么?

    http://android.tgbus.com/lab/software/201208/447420.shtml nfc是什么?nfc功能是什么?出现在我们手机上的nfc功能怎么用?下面请看今天小编 ...

  3. CSU 1997: Seating Arrangement【构造】

    1997: Seating Arrangement Description Mr. Teacher老师班上一共有n个同学,编号为1到n. 在上课的时候Mr. Teacher要求同学们从左至右按1, 2 ...

  4. 谷歌浏览器chrome设置特定网页使用Https(ssl)访问

    1.在浏览器上输入: chrome://net-internals/ 2.在以下位置输入要自动进行https访问的域名即可. 注意:域名不能用范解析,只能一个一个手动输入.

  5. spring与struts2整合出现常见错误

    错误信息 严重: Exception starting filter struts2 Unable to load configuration. - bean - jar:file:/F:/Strut ...

  6. HDU 5360 Hiking(优先队列)

    Hiking Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total S ...

  7. Codis的安装

    其他环境准备: 安装JDK,安装Zookeeper 1.创建codis账户 useradd codis passwd codis 2.解压codis3.1.3-go1.7.4-linux.tar.gz ...

  8. windows的iis做后门,隐藏访问,无日志

    windows下的iis5/iis6做后门,隐藏访问,不留访问记录或者不留日志 好不容易攻下一台Windows2000/2003 IIS服务器,你一定会想,怎样才能长期占有这个“肉鸡”呢?聪明的你肯定 ...

  9. TextView划线 android

    TextView  加下划线 . 中划线 下过如图: // 中划线 textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.A ...

  10. GetDlgItem() 出现错误

    写MFC程序ASSERT(IsWindow(pTemp->m_hWnd))报错 CRect rect; CWnd *pWnd = GetDlgItem(IDC_picture);//IDC_pi ...