mysql-5.6.28源码安装 整个安装过程详细教程,详解

来源:互联网 发布:北京中标软件怎么样 编辑:程序博客网 时间:2024/06/05 08:20
先创建普通用户
[root@localhost home]# useradd -d /home/sh -m sh[root@localhost home]# passwd sh更改用户 sh 的密码 。新的 密码:无效的密码: 它基于字典单词重新输入新的 密码:passwd: 所有的身份验证令牌已经成功更新。[root@localhost home]# su sh[sh@localhost home]$ cd /home/sh/[sh@localhost ~]$ mkdir webapps bin conf src app local tomcat[sh@localhost ~]$ ll总用量 28drwxrwxr-x. 2 sh sh 4096 4月  26 01:55 appdrwxrwxr-x. 2 sh sh 4096 4月  26 01:55 bindrwxrwxr-x. 2 sh sh 4096 4月  26 01:55 confdrwxrwxr-x. 2 sh sh 4096 4月  26 01:55 localdrwxrwxr-x. 2 sh sh 4096 4月  26 01:55 srcdrwxrwxr-x. 2 sh sh 4096 4月  26 01:55 tomcatdrwxrwxr-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/查看已经装的版本[sh@localhost src]$ rpm -qa | grep mysqlmysql-5.1.73-3.el6_5.x86_64mysql-libs-5.1.73-3.el6_5.x86_64mysql-connector-odbc-5.1.5r1144-7.el6.x86_64[root@localhost home]# rpm -qa | grep mysqlmysql-5.1.73-3.el6_5.x86_64mysql-libs-5.1.73-3.el6_5.x86_64mysql-connector-odbc-5.1.5r1144-7.el6.x86_64[root@localhost 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.cnbase                                                                                               | 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     不删除任何软件包[root@localhost home]# rpm -qa | grep mysql                     mysql-5.1.73-3.el6_5.x86_64mysql-libs-5.1.73-3.el6_5.x86_64mysql-connector-odbc-5.1.5r1144-7.el6.x86_64[root@localhost 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                                                                                           完毕![root@localhost home]# rpm -qa | grep mysql                  mysql-libs-5.1.73-3.el6_5.x86_64mysql-connector-odbc-5.1.5r1144-7.el6.x86_64[root@localhost 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                         完毕![root@localhost home]# rpm -qa | grep mysql                       [root@localhost home]# 安装依赖[root@localhost data]# yum -y install wget gcc gcc-c++ ncurses-devel cmake make perl[root@localhost data]# rpm -qa | grep wgetwget-1.12-5.el6_6.1.x86_64[root@localhost data]# rpm -qa | grep gccgcc-4.4.7-16.el6.x86_64libgcc-4.4.7-16.el6.x86_64gcc-c++-4.4.7-16.el6.x86_64创建mysql用户组[root@localhost data]# groupadd mysql创建Mysql用户[root@localhost data]# useradd -r -g mysql mysql看下是否成功[root@localhost data]# id mysqluid=501(mysql) gid=501(mysql) 组=501(mysql)创建mysql安装目录和数据库文件存放目录[root@localhost data]# mkdir -p /usr/local/mysql[root@localhost data]# mkdir -p /usr/local/mysql/data切换到mysql源码的目录,解出源码包[root@localhost sh]# cd src/[root@localhost 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[root@localhost src]# tar -zxvf mysql-5.6.28.tar.gz [root@localhost src]# cd mysql-5.6.28[root@localhost mysql-5.6.28]# ll总用量 732drwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 BUILD-rw-r--r--.  1 7161 wheel    142 11月 16 17:38 BUILD-CMAKEdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 clientdrwxr-xr-x.  4 7161 wheel   4096 11月 16 18:45 cmake-rw-r--r--.  1 7161 wheel  21711 11月 16 17:38 CMakeLists.txtdrwxr-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 COPYINGdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 dbugdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 Docs-rw-r--r--.  1 7161 wheel  65958 11月 16 17:38 Doxyfile-perfschemadrwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 extradrwxr-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-SOURCEdrwxr-xr-x.  7 7161 wheel   4096 11月 16 18:45 libeventdrwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 libmysqldrwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 libmysqlddrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 libservicesdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 mandrwxr-xr-x. 10 7161 wheel   4096 11月 16 18:45 mysql-testdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 mysysdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 mysys_ssldrwxr-xr-x. 15 7161 wheel   4096 11月 16 18:45 packagingdrwxr-xr-x.  9 7161 wheel   4096 11月 16 18:45 plugin-rw-r--r--.  1 7161 wheel   2496 11月 16 17:38 READMEdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 regexdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 scriptsdrwxr-xr-x.  4 7161 wheel  20480 11月 16 18:45 sqldrwxr-xr-x.  5 7161 wheel   4096 11月 16 18:45 sql-benchdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 sql-commondrwxr-xr-x. 13 7161 wheel   4096 11月 16 18:45 storagedrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 stringsdrwxr-xr-x.  5 7161 wheel   4096 11月 16 18:45 support-filesdrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 testsdrwxr-xr-x.  5 7161 wheel   4096 11月 16 18:45 unittest-rw-r--r--.  1 7161 wheel     88 11月 16 17:38 VERSIONdrwxr-xr-x.  3 7161 wheel   4096 11月 16 18:45 viodrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 windrwxr-xr-x.  2 7161 wheel   4096 11月 16 18:45 zlib这一步应该cmake配置,之前先看看cmake选项,有点长,不想看可略到11步[root@localhost 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=1Warning: 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 doneCMake 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如果出现以上报错信息的话就[root@localhost mysql-5.6.28]# yum install bison然后再[root@localhost 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[root@localhost 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[root@localhost 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编译代码,这个时间比较长[root@localhost mysql-5.6.28]# make安装[root@localhost mysql-5.6.28]# make install查看下结果[root@localhost mysql-5.6.28]# ll /usr/local/mysql/总用量 172drwxr-xr-x.  2 root root   4096 4月  26 02:54 bin-rw-r--r--.  1 root root  17987 11月 16 17:38 COPYINGdrwxr-xr-x.  3 root root   4096 4月  26 02:54 datadrwxr-xr-x.  2 root root   4096 4月  26 02:54 docsdrwxr-xr-x.  3 root root   4096 4月  26 02:54 include-rw-r--r--.  1 root root 105684 11月 16 18:45 INSTALL-BINARYdrwxr-xr-x.  3 root root   4096 4月  26 02:54 libdrwxr-xr-x.  4 root root   4096 4月  26 02:54 mandrwxr-xr-x. 10 root root   4096 4月  26 02:54 mysql-test-rw-r--r--.  1 root root   2496 11月 16 17:38 READMEdrwxr-xr-x.  2 root root   4096 4月  26 02:54 scriptsdrwxr-xr-x. 28 root root   4096 4月  26 02:54 sharedrwxr-xr-x.  4 root root   4096 4月  26 02:54 sql-benchdrwxr-xr-x.  2 root root   4096 4月  26 02:54 support-files[root@localhost mysql-5.6.28]# ll /usr/local/mysql/data/总用量 4drwxr-xr-x. 2 root root 4096 4月  26 02:54 test清楚临时文件[root@localhost mysql-5.6.28]# make clean修改目录属主数组[root@localhost mysql-5.6.28]# chown -R mysql:mysql /usr/local/mysql/data[root@localhost mysql-5.6.28]# chown -R mysql:mysql /usr/local/mysql创建MySQL Server系统表[root@iZ23h0vz72uZ mysql-5.6.28]# cd /usr/local/mysql/[root@localhost mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/dataInstalling 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 pages2016-04-26 02:57:25 26284 [Note] InnoDB: The InnoDB memory heap is disabled2016-04-26 02:57:25 26284 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2016-04-26 02:57:25 26284 [Note] InnoDB: Memory barrier is not used2016-04-26 02:57:25 26284 [Note] InnoDB: Compressed tables use zlib 1.2.32016-04-26 02:57:25 26284 [Note] InnoDB: Using CPU crc32 instructions2016-04-26 02:57:25 26284 [Note] InnoDB: Initializing buffer pool, size = 128.0M2016-04-26 02:57:25 26284 [Note] InnoDB: Completed initialization of buffer pool2016-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 MB2016-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 MB2016-04-26 02:57:25 26284 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2016-04-26 02:57:25 26284 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02016-04-26 02:57:25 26284 [Warning] InnoDB: New log files created, LSN=457812016-04-26 02:57:25 26284 [Note] InnoDB: Doublewrite buffer not found: creating new2016-04-26 02:57:25 26284 [Note] InnoDB: Doublewrite buffer created2016-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 created2016-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 start2016-04-26 02:57:25 26284 [Note] InnoDB: 5.6.28 started; log sequence number 02016-04-26 02:57:26 26284 [Note] Binlog end2016-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 1625977OKFilling 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 pages2016-04-26 02:57:27 26307 [Note] InnoDB: The InnoDB memory heap is disabled2016-04-26 02:57:27 26307 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2016-04-26 02:57:27 26307 [Note] InnoDB: Memory barrier is not used2016-04-26 02:57:27 26307 [Note] InnoDB: Compressed tables use zlib 1.2.32016-04-26 02:57:27 26307 [Note] InnoDB: Using CPU crc32 instructions2016-04-26 02:57:27 26307 [Note] InnoDB: Initializing buffer pool, size = 128.0M2016-04-26 02:57:27 26307 [Note] InnoDB: Completed initialization of buffer pool2016-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 start2016-04-26 02:57:27 26307 [Note] InnoDB: 5.6.28 started; log sequence number 16259772016-04-26 02:57:27 26307 [Note] Binlog end2016-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 1625987OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE 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_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly 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.plPlease report any problems at http://bugs.mysql.com/The latest information about MySQL is available on the web at  http://www.mysql.comSupport MySQL by buying support/licenses at http://shop.mysql.comNew default config file was created as ./my.cnf andwill be used by default by the server when you start it.You may edit this file to change server settings[root@localhost 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[root@localhost mysql]# chown -R mysql:mysql /usr/local/mysql配置启动脚本[root@localhost mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql启动MySQL[root@localhost mysql]# /etc/init.d/mysql status ERROR! MySQL is not running[root@localhost mysql]# /etc/init.d/mysql startStarting MySQL. SUCCESS! [root@localhost mysql]# ps -aux |grep mysqlWarning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQroot     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.pidmysql    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.pidroot     26516  0.0  0.0 103256   844 pts/0    S+   03:01   0:00 grep mysql配置环境变量[root@localhost mysql]# vi /etc/profile在后面加上PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/libexport PATH变量生效[root@localhost mysql]# source /etc/profile设置数据库密码[root@localhost mysql]# mysql -u root mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.28 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use mysql;//切换到Mysql表Database changedmysql> 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 root@"%" 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: 0mysql> select host,user,password  from user where User='root';mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> \qBye根据需要设置开机自动启动服务[root@localhost mysql]# chkconfig mysql on在此就设置结束了使用navicat登录mysql就可以了sudo /etc/init.d/mysql restart

0 0