mysql-5.6.28 整个安装过程,详解

先创建普通用户
[[email protected] home]# useradd -d /home/sh -m sh
[[email protected] home]# passwd sh
更改用户 sh 的密码 。
新的 密码:
无效的密码: 它基于字典单词
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。
[[email protected] home]# su sh
[[email protected] home]$ cd /home/sh/
[[email protected] ~]$ mkdir webapps bin conf src app local tomcat
[[email protected] ~]$ ll
总用量 28
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 app
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 bin
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 conf
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 local
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 src
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 tomcat
drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 webapps

然后利用FileZilla上传cmake-2.8.10.2.tar.gz,libevent-1.2.tar.gz,mysql-5.6.28.tar.gz

或者下载
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz/from/http://cdn.mysql.com/

查看已经装的版本
[[email protected] src]$ rpm -qa | grep mysql
mysql-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64

[[email protected] home]# rpm -qa | grep mysql
mysql-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
[[email protected] home]# yum remove mysql-libs-5.1.71-1.el6.x86_64
已加载插件:fastestmirror, security
设置移除进程
参数 mysql-libs-5.1.71-1.el6.x86_64 没有匹配
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
base                                                                                               | 3.7 kB     00:00
extras                                                                                             | 3.4 kB     00:00
extras/primary_db                                                                                  |  37 kB     00:00
updates                                                                                            | 3.4 kB     00:00
updates/primary_db                                                                                 | 4.7 MB     00:03
不删除任何软件包
[[email protected] home]# rpm -qa | grep mysql
mysql-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
[[email protected] home]# yum remove mysql-5.1.73-3.el6_5.x86_64
已加载插件:fastestmirror, security
设置移除进程
解决依赖关系
--> 执行事务检查
---> Package mysql.x86_64 0:5.1.73-3.el6_5 will be 删除
--> 完成依赖关系计算

依赖关系解决

==========================================================================================================================
 软件包           架构              版本                        仓库                                                 大小
==========================================================================================================================
正在删除:
 mysql            x86_64            5.1.73-3.el6_5              @anaconda-CentOS-201410241409.x86_64/6.6            2.4 M

事务概要
==========================================================================================================================
Remove        1 Package(s)

Installed size: 2.4 M
确定吗?[y/N]:y
下载软件包:
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
  正在删除   : mysql-5.1.73-3.el6_5.x86_64                                                                            1/1
  Verifying  : mysql-5.1.73-3.el6_5.x86_64                                                                            1/1 

删除:
  mysql.x86_64 0:5.1.73-3.el6_5                                                                                           

完毕!
[[email protected] home]# rpm -qa | grep mysql
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
[[email protected] home]# yum remove mysql-libs-5.1.73-3.el6_5.x86_64
已加载插件:fastestmirror, security
设置移除进程
解决依赖关系
--> 执行事务检查
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be 删除
--> 处理依赖关系 libmysqlclient.so.16()(64bit),它被软件包 2:postfix-2.6.6-6.el6_5.x86_64 需要
--> 处理依赖关系 libmysqlclient.so.16(libmysqlclient_16)(64bit),它被软件包 2:postfix-2.6.6-6.el6_5.x86_64 需要
--> 处理依赖关系 libmysqlclient_r.so.16()(64bit),它被软件包 mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 需要
--> 处理依赖关系 libmysqlclient_r.so.16()(64bit),它被软件包 MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 需要
--> 处理依赖关系 libmysqlclient_r.so.16(libmysqlclient_16)(64bit),它被软件包 mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 需要
--> 处理依赖关系 libmysqlclient_r.so.16(libmysqlclient_16)(64bit),它被软件包 MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 需要
--> 处理依赖关系 mysql-libs,它被软件包 2:postfix-2.6.6-6.el6_5.x86_64 需要
--> 执行事务检查
---> Package MySQL-python.x86_64 0:1.2.3-0.3.c1.1.el6 will be 删除
---> Package mysql-connector-odbc.x86_64 0:5.1.5r1144-7.el6 will be 删除
---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be 删除
--> 处理依赖关系 /usr/sbin/sendmail,它被软件包 redhat-lsb-core-4.0-7.el6.centos.x86_64 需要
--> 处理依赖关系 /usr/sbin/sendmail,它被软件包 cronie-1.4.4-12.el6.x86_64 需要
--> 执行事务检查
---> Package cronie.x86_64 0:1.4.4-12.el6 will be 删除
--> 处理依赖关系 cronie = 1.4.4-12.el6,它被软件包 cronie-anacron-1.4.4-12.el6.x86_64 需要
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6.centos will be 删除
--> 处理依赖关系 redhat-lsb-core(x86-64) = 4.0,它被软件包 redhat-lsb-printing-4.0-7.el6.centos.x86_64 需要
--> 处理依赖关系 redhat-lsb-core(x86-64) = 4.0-7.el6.centos,它被软件包 redhat-lsb-4.0-7.el6.centos.x86_64 需要
--> 处理依赖关系 redhat-lsb-core(x86-64) = 4.0,它被软件包 redhat-lsb-graphics-4.0-7.el6.centos.x86_64 需要
--> 执行事务检查
---> Package cronie-anacron.x86_64 0:1.4.4-12.el6 will be 删除
---> Package redhat-lsb.x86_64 0:4.0-7.el6.centos will be 删除
--> 处理依赖关系 redhat-lsb(x86-64) = 4.0-7.el6.centos,它被软件包 redhat-lsb-compat-4.0-7.el6.centos.x86_64 需要
---> Package redhat-lsb-graphics.x86_64 0:4.0-7.el6.centos will be 删除
---> Package redhat-lsb-printing.x86_64 0:4.0-7.el6.centos will be 删除
--> 执行事务检查
---> Package redhat-lsb-compat.x86_64 0:4.0-7.el6.centos will be 删除
--> 处理依赖关系 /lib/lsb/init-functions,它被软件包 tomcat6-6.0.24-80.el6.x86_64 需要
--> 处理依赖关系 /etc/cron.d,它被软件包 crontabs-1.10-33.el6.noarch 需要
--> 处理依赖关系 /etc/cron.d,它被软件包 sysstat-9.0.4-27.el6.x86_64 需要
--> 使用新的信息重新计算依赖关系
--> 执行事务检查
---> Package crontabs.noarch 0:1.10-33.el6 will be 删除
--> 处理依赖关系 crontabs,它被软件包 webalizer-2.21_02-3.3.el6.x86_64 需要
---> Package sysstat.x86_64 0:9.0.4-27.el6 will be 删除
---> Package tomcat6.x86_64 0:6.0.24-80.el6 will be 删除
--> 执行事务检查
---> Package webalizer.x86_64 0:2.21_02-3.3.el6 will be 删除
--> 完成依赖关系计算

依赖关系解决

==========================================================================================================================
 软件包                     架构         版本                        仓库                                            大小
==========================================================================================================================
正在删除:
 mysql-libs                 x86_64       5.1.73-3.el6_5              @anaconda-CentOS-201410241409.x86_64/6.6       4.0 M
为依赖而移除:
 MySQL-python               x86_64       1.2.3-0.3.c1.1.el6          @anaconda-CentOS-201410241409.x86_64/6.6       246 k
 cronie                     x86_64       1.4.4-12.el6                @anaconda-CentOS-201410241409.x86_64/6.6       174 k
 cronie-anacron             x86_64       1.4.4-12.el6                @anaconda-CentOS-201410241409.x86_64/6.6        43 k
 crontabs                   noarch       1.10-33.el6                 @anaconda-CentOS-201410241409.x86_64/6.6       2.4 k
 mysql-connector-odbc       x86_64       5.1.5r1144-7.el6            @anaconda-CentOS-201410241409.x86_64/6.6       345 k
 postfix                    x86_64       2:2.6.6-6.el6_5             @anaconda-CentOS-201410241409.x86_64/6.6       9.7 M
 redhat-lsb                 x86_64       4.0-7.el6.centos            @anaconda-CentOS-201410241409.x86_64/6.6       0.0
 redhat-lsb-compat          x86_64       4.0-7.el6.centos            @anaconda-CentOS-201410241409.x86_64/6.6       0.0
 redhat-lsb-core            x86_64       4.0-7.el6.centos            @anaconda-CentOS-201410241409.x86_64/6.6        22 k
 redhat-lsb-graphics        x86_64       4.0-7.el6.centos            @anaconda-CentOS-201410241409.x86_64/6.6       0.0
 redhat-lsb-printing        x86_64       4.0-7.el6.centos            @anaconda-CentOS-201410241409.x86_64/6.6       0.0
 sysstat                    x86_64       9.0.4-27.el6                @anaconda-CentOS-201410241409.x86_64/6.6       825 k
 tomcat6                    x86_64       6.0.24-80.el6               @anaconda-CentOS-201410241409.x86_64/6.6       188 k
 webalizer                  x86_64       2.21_02-3.3.el6             @anaconda-CentOS-201410241409.x86_64/6.6       324 k

事务概要
==========================================================================================================================
Remove       15 Package(s)

Installed size: 16 M
确定吗?[y/N]:y
下载软件包:
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
  正在删除   : redhat-lsb-compat-4.0-7.el6.centos.x86_64                                                             1/15
  正在删除   : redhat-lsb-4.0-7.el6.centos.x86_64                                                                    2/15
  正在删除   : redhat-lsb-graphics-4.0-7.el6.centos.x86_64                                                           3/15
  正在删除   : redhat-lsb-printing-4.0-7.el6.centos.x86_64                                                           4/15
  正在删除   : tomcat6-6.0.24-80.el6.x86_64                                                                          5/15
  正在删除   : redhat-lsb-core-4.0-7.el6.centos.x86_64                                                               6/15
  正在删除   : mysql-connector-odbc-5.1.5r1144-7.el6.x86_64                                                          7/15
/var/tmp/rpm-tmp.yTrcO8: line 1: lsb_release: command not found
  正在删除   : MySQL-python-1.2.3-0.3.c1.1.el6.x86_64                                                                8/15
  正在删除   : sysstat-9.0.4-27.el6.x86_64                                                                           9/15
  正在删除   : webalizer-2.21_02-3.3.el6.x86_64                                                                     10/15
  正在删除   : crontabs-1.10-33.el6.noarch                                                                          11/15
  正在删除   : cronie-anacron-1.4.4-12.el6.x86_64                                                                   12/15
  正在删除   : cronie-1.4.4-12.el6.x86_64                                                                           13/15
  正在删除   : 2:postfix-2.6.6-6.el6_5.x86_64                                                                       14/15
  正在删除   : mysql-libs-5.1.73-3.el6_5.x86_64                                                                     15/15
  Verifying  : redhat-lsb-printing-4.0-7.el6.centos.x86_64                                                           1/15
  Verifying  : cronie-anacron-1.4.4-12.el6.x86_64                                                                    2/15
  Verifying  : webalizer-2.21_02-3.3.el6.x86_64                                                                      3/15
  Verifying  : mysql-libs-5.1.73-3.el6_5.x86_64                                                                      4/15
  Verifying  : redhat-lsb-4.0-7.el6.centos.x86_64                                                                    5/15
  Verifying  : redhat-lsb-core-4.0-7.el6.centos.x86_64                                                               6/15
  Verifying  : sysstat-9.0.4-27.el6.x86_64                                                                           7/15
  Verifying  : MySQL-python-1.2.3-0.3.c1.1.el6.x86_64                                                                8/15
  Verifying  : crontabs-1.10-33.el6.noarch                                                                           9/15
  Verifying  : redhat-lsb-compat-4.0-7.el6.centos.x86_64                                                            10/15
  Verifying  : tomcat6-6.0.24-80.el6.x86_64                                                                         11/15
  Verifying  : mysql-connector-odbc-5.1.5r1144-7.el6.x86_64                                                         12/15
  Verifying  : cronie-1.4.4-12.el6.x86_64                                                                           13/15
  Verifying  : 2:postfix-2.6.6-6.el6_5.x86_64                                                                       14/15
  Verifying  : redhat-lsb-graphics-4.0-7.el6.centos.x86_64                                                          15/15 

删除:
  mysql-libs.x86_64 0:5.1.73-3.el6_5                                                                                      

作为依赖被删除:
  MySQL-python.x86_64 0:1.2.3-0.3.c1.1.el6                     cronie.x86_64 0:1.4.4-12.el6
  cronie-anacron.x86_64 0:1.4.4-12.el6                         crontabs.noarch 0:1.10-33.el6
  mysql-connector-odbc.x86_64 0:5.1.5r1144-7.el6               postfix.x86_64 2:2.6.6-6.el6_5
  redhat-lsb.x86_64 0:4.0-7.el6.centos                         redhat-lsb-compat.x86_64 0:4.0-7.el6.centos
  redhat-lsb-core.x86_64 0:4.0-7.el6.centos                    redhat-lsb-graphics.x86_64 0:4.0-7.el6.centos
  redhat-lsb-printing.x86_64 0:4.0-7.el6.centos                sysstat.x86_64 0:9.0.4-27.el6
  tomcat6.x86_64 0:6.0.24-80.el6                               webalizer.x86_64 0:2.21_02-3.3.el6                         

完毕!
[[email protected] home]# rpm -qa | grep mysql
[[email protected] home]#
安装依赖
[[email protected] data]# yum -y install wget gcc gcc-c++ ncurses-devel cmake make perl

[[email protected] data]# rpm -qa | grep wget
wget-1.12-5.el6_6.1.x86_64
[[email protected] data]# rpm -qa | grep gcc
gcc-4.4.7-16.el6.x86_64
libgcc-4.4.7-16.el6.x86_64
gcc-c++-4.4.7-16.el6.x86_64

创建mysql用户组
[[email protected] data]# groupadd mysql
创建Mysql用户
[[email protected] data]# useradd -r -g mysql mysql

看下是否成功
[[email protected] data]# id mysql
uid=501(mysql) gid=501(mysql) 组=501(mysql)

创建mysql安装目录和数据库文件存放目录
[[email protected] data]# mkdir -p /usr/local/mysql
[[email protected] data]# mkdir -p /usr/local/mysql/data
切换到mysql源码的目录,解出源码包
[[email protected] sh]# cd src/
[[email protected] src]# ll
总用量 214948
-rw-r--r--. 1 root root   8886737 4月  26 02:01 apache-tomcat-7.0.67.tar.gz
-rw-r--r--. 1 root root  10571419 4月  26 02:01 apache-tomcat-8.0.15-windows-x64.zip
-rw-r--r--. 1 root root   5768373 4月  26 02:00 cmake-2.8.10.2.tar.gz
-rw-r--r--. 1 root root 160901914 4月  26 02:01 jdk-8u31-linux-x64.tar.gz
-rw-r--r--. 1 root root    413811 4月  26 02:00 libevent-1.2.tar.gz
-rw-r--r--. 1 root root  32182980 4月  26 02:01 mysql-5.6.28.tar.gz
-rw-r--r--. 1 root root   1366160 4月  26 02:01 redis-3.0.5.tar.gz
[[email protected] src]# tar -zxvf mysql-5.6.28.tar.gz
[[email protected] src]# cd mysql-5.6.28
[[email protected] mysql-5.6.28]# ll
总用量 732
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 BUILD
-rw-r--r--.  1 7161 wheel    142 11月 16 17:38 BUILD-CMAKE
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 client
drwxr-xr-x.  4 7161 wheel   4096 11月 16 18:45 cmake
-rw-r--r--.  1 7161 wheel  21711 11月 16 17:38 CMakeLists.txt
drwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 cmd-line-utils
-rw-r--r--.  1 7161 wheel  19628 11月 16 17:38 config.h.cmake
-rw-r--r--.  1 7161 wheel  40292 11月 16 17:38 configure.cmake
-rw-r--r--.  1 7161 wheel  17987 11月 16 17:38 COPYING
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 dbug
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 Docs
-rw-r--r--.  1 7161 wheel  65958 11月 16 17:38 Doxyfile-perfschema
drwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 extra
drwxr-xr-x.  4 7161 wheel   4096 11月 16 18:45 include
-rw-r--r--.  1 7161 wheel 409774 11月 16 18:45 INSTALL-SOURCE
-rw-r--r--.  1 7161 wheel    247 11月 16 17:38 INSTALL-WIN-SOURCE
drwxr-xr-x.  7 7161 wheel   4096 11月 16 18:45 libevent
drwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 libmysql
drwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 libmysqld
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 libservices
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 man
drwxr-xr-x. 10 7161 wheel   4096 11月 16 18:45 mysql-test
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 mysys
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 mysys_ssl
drwxr-xr-x. 15 7161 wheel   4096 11月 16 18:45 packaging
drwxr-xr-x.  9 7161 wheel   4096 11月 16 18:45 plugin
-rw-r--r--.  1 7161 wheel   2496 11月 16 17:38 README
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 regex
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 scripts
drwxr-xr-x.  4 7161 wheel  20480 11月 16 18:45 sql
drwxr-xr-x.  5 7161 wheel   4096 11月 16 18:45 sql-bench
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 sql-common
drwxr-xr-x. 13 7161 wheel   4096 11月 16 18:45 storage
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 strings
drwxr-xr-x.  5 7161 wheel   4096 11月 16 18:45 support-files
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 tests
drwxr-xr-x.  5 7161 wheel   4096 11月 16 18:45 unittest
-rw-r--r--.  1 7161 wheel     88 11月 16 17:38 VERSION
drwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 vio
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 win
drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 zlib

这一步应该cmake配置,之前先看看cmake选项,有点长,不想看可略到11步

[[email protected] mysql-5.6.28]# cmake -DCMAKE_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=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DENABLE_DOWNLOADS=1
Warning: Bison executable not found in PATH
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    MYSQL_USER

-- Build files have been written to: /home/sh/src/mysql-5.6.28
如果出现以上报错信息的话就
[[email protected] mysql-5.6.28]# yum install bison

然后再
[[email protected] mysql-5.6.28]# cmake -DCMAKE_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=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DENABLE_DOWNLOADS=1

-- Running cmake version 2.8.12.2
-- Could NOT find Git (missing:  GIT_EXECUTABLE)
-- MySQL 5.6.28
-- Packaging as: mysql-5.6.28-Linux-x86_64
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Using cmake version 2.8.12.2
-- Not building NDB
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Download failed, error: 6;"Couldn't resolve host name"
-- To enable google test, please download http://googlemock.googlecode.com/files/gmock-1.6.0.zip to the directory /home/sh/src/mysql-5.6.28/source_downloads
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sh/src/mysql-5.6.28

如果报以上错误的话Could NOT find Git (missing:  GIT_EXECUTABLE)就安装git
[[email protected] mysql-5.6.28]# yum install git

-- Running cmake version 2.8.12.2
-- Found Git: /usr/bin/git (found version "1.7.1")
-- MySQL 5.6.28
-- Packaging as: mysql-5.6.28-Linux-x86_64
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Using cmake version 2.8.12.2
-- Not building NDB
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Download failed, error: 7;"Couldn't connect to server"
-- To enable google test, please download http://googlemock.googlecode.com/files/gmock-1.6.0.zip to the directory /home/sh/src/mysql-5.6.28/source_downloads
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sh/src/mysql-5.6.28

[[email protected] mysql-5.6.28]# cmake -DCMAKE_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=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DENABLE_DOWNLOADS=1

编译代码,这个时间比较长
[[email protected] mysql-5.6.28]# make
安装
[[email protected] mysql-5.6.28]# make install

查看下结果
[[email protected] mysql-5.6.28]# ll /usr/local/mysql/
总用量 172
drwxr-xr-x.  2 root root   4096 4月  26 02:54 bin
-rw-r--r--.  1 root root  17987 11月 16 17:38 COPYING
drwxr-xr-x.  3 root root   4096 4月  26 02:54 data
drwxr-xr-x.  2 root root   4096 4月  26 02:54 docs
drwxr-xr-x.  3 root root   4096 4月  26 02:54 include
-rw-r--r--.  1 root root 105684 11月 16 18:45 INSTALL-BINARY
drwxr-xr-x.  3 root root   4096 4月  26 02:54 lib
drwxr-xr-x.  4 root root   4096 4月  26 02:54 man
drwxr-xr-x. 10 root root   4096 4月  26 02:54 mysql-test
-rw-r--r--.  1 root root   2496 11月 16 17:38 README
drwxr-xr-x.  2 root root   4096 4月  26 02:54 scripts
drwxr-xr-x. 28 root root   4096 4月  26 02:54 share
drwxr-xr-x.  4 root root   4096 4月  26 02:54 sql-bench
drwxr-xr-x.  2 root root   4096 4月  26 02:54 support-files
[[email protected] mysql-5.6.28]# ll /usr/local/mysql/data/
总用量 4
drwxr-xr-x. 2 root root 4096 4月  26 02:54 test

清楚临时文件
[[email protected] mysql-5.6.28]# make clean

修改目录属主数组
[[email protected] mysql-5.6.28]# chown -R mysql:mysql /usr/local/mysql/data
[[email protected] mysql-5.6.28]# chown -R mysql:mysql /usr/local/mysql

创建MySQL Server系统表
[[email protected] mysql-5.6.28]# cd /usr/local/mysql/
[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
Installing MySQL system tables...2016-04-26 02:57:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-26 02:57:25 0 [Note] ./bin/mysqld (mysqld 5.6.28) starting as process 26284 ...
2016-04-26 02:57:25 26284 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-04-26 02:57:25 26284 [Note] InnoDB: The InnoDB memory heap is disabled
2016-04-26 02:57:25 26284 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-04-26 02:57:25 26284 [Note] InnoDB: Memory barrier is not used
2016-04-26 02:57:25 26284 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-04-26 02:57:25 26284 [Note] InnoDB: Using CPU crc32 instructions
2016-04-26 02:57:25 26284 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-04-26 02:57:25 26284 [Note] InnoDB: Completed initialization of buffer pool
2016-04-26 02:57:25 26284 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-04-26 02:57:25 26284 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-04-26 02:57:25 26284 [Note] InnoDB: Database physically writes the file full: wait...
2016-04-26 02:57:25 26284 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-04-26 02:57:25 26284 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-04-26 02:57:25 26284 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-04-26 02:57:25 26284 [Warning] InnoDB: New log files created, LSN=45781
2016-04-26 02:57:25 26284 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-04-26 02:57:25 26284 [Note] InnoDB: Doublewrite buffer created
2016-04-26 02:57:25 26284 [Note] InnoDB: 128 rollback segment(s) are active.
2016-04-26 02:57:25 26284 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-04-26 02:57:25 26284 [Note] InnoDB: Foreign key constraint system tables created
2016-04-26 02:57:25 26284 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-04-26 02:57:25 26284 [Note] InnoDB: Tablespace and datafile system tables created.
2016-04-26 02:57:25 26284 [Note] InnoDB: Waiting for purge to start
2016-04-26 02:57:25 26284 [Note] InnoDB: 5.6.28 started; log sequence number 0
2016-04-26 02:57:26 26284 [Note] Binlog end
2016-04-26 02:57:26 26284 [Note] InnoDB: FTS optimize thread exiting.
2016-04-26 02:57:26 26284 [Note] InnoDB: Starting shutdown...
2016-04-26 02:57:27 26284 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2016-04-26 02:57:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-26 02:57:27 0 [Note] ./bin/mysqld (mysqld 5.6.28) starting as process 26307 ...
2016-04-26 02:57:27 26307 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-04-26 02:57:27 26307 [Note] InnoDB: The InnoDB memory heap is disabled
2016-04-26 02:57:27 26307 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-04-26 02:57:27 26307 [Note] InnoDB: Memory barrier is not used
2016-04-26 02:57:27 26307 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-04-26 02:57:27 26307 [Note] InnoDB: Using CPU crc32 instructions
2016-04-26 02:57:27 26307 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-04-26 02:57:27 26307 [Note] InnoDB: Completed initialization of buffer pool
2016-04-26 02:57:27 26307 [Note] InnoDB: Highest supported file format is Barracuda.
2016-04-26 02:57:27 26307 [Note] InnoDB: 128 rollback segment(s) are active.
2016-04-26 02:57:27 26307 [Note] InnoDB: Waiting for purge to start
2016-04-26 02:57:27 26307 [Note] InnoDB: 5.6.28 started; log sequence number 1625977
2016-04-26 02:57:27 26307 [Note] Binlog end
2016-04-26 02:57:27 26307 [Note] InnoDB: FTS optimize thread exiting.
2016-04-26 02:57:27 26307 [Note] InnoDB: Starting shutdown...
2016-04-26 02:57:28 26307 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

  ./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[[email protected] mysql]# scripts/mysql_install_db --help

把初始化生成的 /usr/local/mysql/my.cnf 配置文件的属主数组更改为mysql:
drwxr-xr-x.  2 mysql mysql   4096 4月  26 02:54 support-files
[[email protected] mysql]# chown -R mysql:mysql /usr/local/mysql
配置启动脚本
[[email protected] mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
启动MySQL
[[email protected] mysql]# /etc/init.d/mysql status
 ERROR! MySQL is not running
[[email protected] mysql]# /etc/init.d/mysql start
Starting MySQL. SUCCESS!
[[email protected] mysql]# ps -aux |grep mysql
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root     26388  0.1  0.0 106224  1488 pts/0    S    03:00   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.localdomain.pid
mysql    26491  6.0  5.6 1010016 452156 pts/0  Sl   03:00   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid
root     26516  0.0  0.0 103256   844 pts/0    S+   03:01   0:00 grep mysql

配置环境变量
[[email protected] mysql]# vi /etc/profile

在后面加上
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
export PATH
变量生效
[[email protected] mysql]# source /etc/profile

设置数据库密码
[[email protected] mysql]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.28 Source distribution

Copyright (c) 2000, 2015, 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> use mysql;//切换到Mysql表
Database changed
mysql> desc user;//显示字段
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field                  | Type                              | Null | Key | Default               | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host                   | char(60)                          | NO   | PRI |                       |       |
| User                   | char(16)                          | NO   | PRI |                       |       |
| Password               | char(41)                          | NO   |     |                       |       |
| Select_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Insert_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Update_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Delete_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Create_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Drop_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Reload_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N                     |       |
| Process_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| File_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Grant_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| References_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Index_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Show_db_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Super_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N                     |       |
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Execute_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Create_view_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Show_view_priv         | enum('N','Y')                     | NO   |     | N                     |       |
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N                     |       |
| Create_user_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Event_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Trigger_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N                     |       |
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |                       |       |
| ssl_cipher             | blob                              | NO   |     | NULL                  |       |
| x509_issuer            | blob                              | NO   |     | NULL                  |       |
| x509_subject           | blob                              | NO   |     | NULL                  |       |
| max_questions          | int(11) unsigned                  | NO   |     | 0                     |       |
| max_updates            | int(11) unsigned                  | NO   |     | 0                     |       |
| max_connections        | int(11) unsigned                  | NO   |     | 0                     |       |
| max_user_connections   | int(11) unsigned                  | NO   |     | 0                     |       |
| plugin                 | char(64)                          | YES  |     | mysql_native_password |       |
| authentication_string  | text                              | YES  |     | NULL                  |       |
| password_expired       | enum('N','Y')                     | NO   |     | N                     |       |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
43 rows in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY "root";//为root添加远程连接的能力,据需谨慎操作。
Query OK, 0 rows affected (0.00 sec)

mysql> update user set password = password('1111111') where User='root';//更新root密码
Query OK, 5 rows affected (0.00 sec)
Rows matched: 5  Changed: 5  Warnings: 0

mysql> select host,user,password  from user where User='root';

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

根据需要设置开机自动启动服务
[[email protected] mysql]# chkconfig mysql on

在此就设置结束了
使用navicat登录mysql就可以了

sudo /etc/init.d/mysql restart

时间: 2024-10-31 22:55:50

mysql-5.6.28 整个安装过程,详解的相关文章

Android的学习之路(三)项目的启动过程和安装过程详解

应用的安装和启动过程: 安装:第一步:java的编译器会把这个.java文件编译成.class文件 第二部:Android的SDK提供了一个dx工具,这个工具把.class文件转义成.dex文件 第三部:打包操作,把.dex文件和资源文件进行打包,打包成一个压缩文件,然后进行签名.最后就打包成为了.apk文件 第四部:调用adb指令:adb install c:/x.apk安装到模拟器 具体过程:.JAVA---->.class--.dx-->.dex--->打包签名--->.ap

mysql兼mariadb安装过程详解

mysql兼mariadb下载自己找自己对应的版本: https://dev.mysql.com/downloads/mysql/ 因为5.5以后都用cmake编译了,所以系统里没有的话,就下个源码的装一下,怎么测试系统里有没有装了,在命令行中输入#cma  在按Tab看有没有cmake  有的话系统就装过了,就不用在装了.没有话就去下个吧,下载地址:https://cmake.org/download/ 还要装boost才能装cmake,boost下载地址:https://sourceforg

RabbitMQ 集群安装过程详解

一.安装Erlang 1.rabbitMQ是基于erlang的,所以首先必须配置erlang环境. 从erlang官网下载 otp 18.3.下载链接:http://erlang.org/download/otp_src_18.3.tar.gz linux 可以使用wget http://erlang.org/download/otp_src_18.3.tar.gz 下载 2.解压并配置,编译,安装过程 # tar zvxf otp_src_18.3.tar.gz # mv otp_src_18

SQL Server 2012 Enterprise Edition安装过程详解(包含每一步怎么设置及原因)

一.启动安装程序,点击“安装”选项卡,选择“全新SQL Server独立安装或向现有安装添加功能”.(首次安装数据库系统或向现有数据库系统添加功能,均选择此选项) 二.随后,安装程序进行“安装程序支持规则”的检测,来分析要成功安装SQL Server 2012 Enterprise Edition的前提条件是否都满足.如果存在某一个或多个条件(规则)没有通过,安装过程将无法进行,必须更正失败项才能继续.如果都满足(所有规则的状态为已通过)点击“确定”. 三.输入产品秘钥并点击“下一步”: 四.勾

Citrix_XenServer-6.1安装过程详解(转)

本次为使用VirtualBox虚拟机过安装测试机过程,我们在使用Vm(无论是Vbox还是VMware等)我们的CPU都必须可支持Intel-V或AMD-V,并且在VM软件设置和BIOS设置开启虚拟化支持. Vm基本要求:CPU两核,RAM 1G,系统设置为Linux_x86-64 一.选择键盘类型:US. 二.这个是欢迎界面,选择“OK”即可. 三.这个是使用协议,我们必须得接受,否则就不能继续安装了! 四.这个是警告,告诉你XenServer所需要的硬件条件,我们选择“OK”即可.   六.这

Android应用打包安装过程详解

Android应用打包安装过程(Run as Android Application ): 1,过程:Android Project --> Compilation and Packaging --> Android Package(.apk) --> Signing --(ADB)--> Device or Emulator 2,Android Package(.apk)解压后的内容: META-INF CERT.RSA:加密 res drawable layout menu A

CentOS 7下Cloudera Manager及CDH 6.0.1安装过程详解

一.概念介绍 1.CDH 概览 CDH是Apache Hadoop和相关项目的最完整.最受测试和最流行的发行版.CDH提供Hadoop的核心元素-可伸缩存储和分布式计算-以及基于web的用户界面和重要的企业功能.CDH是Apache许可的开放源码,是唯一提供统一批处理.交互式SQL和交互式搜索以及基于角色的访问控制的Hadoop解决方案. CDH 提供以下特性: 灵活性:存储任何类型的数据并使用各种不同的计算框架进行操作,包括批处理.交互式SQL.免费文本搜索.机器学习和统计计算. 集成:在一个

Linux中centos中httpd源码安装过程详解

在Linux中软件安装有两大类,一类是软件包安装,一类是源代码安装.软件包安装就是指将编译好的二进制封装成rpm包,可以直接使用rpm工具和yum工具安装.源代码安装是指没有编译成二进制,需要通过手动编译的.使用源代码安装的原因有两个,一个就是想使用最新版的软件,另一类就是想自定义其功能的. 在httpd的源码安装过程中需要用到:APR.APR-UTIL. PCRE.httpd源码安装过程:1.展开压缩文件,把压缩文件解压缩到/usr/local/src.2.在解压文件目录使用 ./config

(MYSQL)SQL优化工具 - SQLAdvisor 安装使用详解

一.SQLAdvisor简介 SQLAdvisor是由美团点评公司技术工程部DBA团队(北京)开发维护的一个分析SQL给出索引优化建议的工具.它基于MySQL原生态词法解析,结合分析SQL中的where条件.聚合条件.多表Join关系 给出索引优化建议.目前SQLAdvisor在美团点评广泛应用,包括美团支付.酒店旅游.外卖.团购等产品线,公司内部对SQLAdvisor的开发全面转到github上,开源和内部使用保持一致. 二.SQLAdvisor安装 1.拉取最新代码 git clone ht

SQL Server 2012 安装过程详解(包含每一步设置的含义)

转http://www.cnblogs.com/EastLiRoar/p/4051969.html 一.启动安装程序,点击"安装"选项卡,选择"全新SQL Server独立安装或向现有安装添加功能".(首次安装数据库系统或向现有数据库系统添加功能,均选择此选项)