zoukankan      html  css  js  c++  java
  • CentOS 6.5 源码安装MySQL5.6

    1:下载安装cmake (mysql5.5以后是通过cmake来编译的)

    #http://download.csdn.net/detail/csxuedn/7976005
    
    #wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
    
    # tar -zxv -f /root/cmake-2.8.4.tar.gz
    # cd cmake-2.8.4
    #./configure
    Error when bootstrapping CMake:
    Cannot find appropriate C++ compiler on this system.
    Please specify one using environment variable CXX.
    See cmake_bootstrap.log for compilers attempted.
    
     
    
       #yum install gcc-c++
    
    #./configure
    # make && make install
    

      

    2:创建mysql的安装目录及数据库存放目录

    #mkdir -p /gechong/mysql                 //安装mysql 
    #mkdir -p /gechong/mysql/data            //存放数据库
    

      

    3:创建mysql用户及用户组

    #groupadd mysql
    
    #useradd -g mysql -s /bin/false -M mysql
    

      

    4:安装mysql

    #wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.21.tar.gz
    

    [root@10-4-5-9 gechong]# ls
    mysql

    [root@10-4-5-9 gechong]# pwd
    /gechong

    
    

    [root@10-4-5-9 gechong]# tar -zxv -f /root/mysql-5.6.21.tar.gz

    [root@10-4-5-9 gechong]# cd mysql-5.6.21/

    编译:

     cmake . 
    -DCMAKE_INSTALL_PREFIX=/gechong/mysql 
    -DMYSQL_DATADIR=/gechong/mysql/data 
    -DDEFAULT_CHARSET=utf8 
    -DDEFAULT_COLLATION=utf8_general_ci 
    -DEXTRA_CHARSETS=all 
    -DENABLED_LOCAL_INFILE=1 
    

    报错了:

    CMake Error at cmake/readline.cmake:85 (MESSAGE):
      Curses library not found.  Please install appropriate package,
    
          remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
    Call Stack (most recent call first):
      cmake/readline.cmake:128 (FIND_CURSES)
      cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
      CMakeLists.txt:427 (MYSQL_CHECK_EDITLINE)
    
    
    -- Configuring incomplete, errors occurred!
    

     

    #yum -y install ncurses-devel
    
    #rm -f CMakeCache.txt
    

      

    重新编译:

    # make clean

    # rm -f CMakeCache.txt

    # rm -rf /etc/my.cnf

     cmake . 
    -DCMAKE_INSTALL_PREFIX=/gechong/mysql 
    -DMYSQL_DATADIR=/gechong/mysql/data 
    -DDEFAULT_CHARSET=utf8 
    -DDEFAULT_COLLATION=utf8_general_ci 
    -DEXTRA_CHARSETS=all 
    -DENABLED_LOCAL_INFILE=1 
    
    #make && make install
    

     很慢。。。等着吧

     

    5:配置MySQL

    # cd /gechong/mysql
    # chown -R root:mysql .
    # chown -R mysql:mysql data

      

    6:

    # cp support-files/my-default.cnf /etc/my.cnf

      

    7:初始化权限表

    #scripts/mysql_install_db --user=mysql
    

      

    8:启动MySQL服务

    #ln -s /gechong/mysql/bin/mysql /usr/bin
    
    #service mysqld start 

    10:之后空用户登陆MySQL,删除空用户,对用户赋权限。

  • 相关阅读:
    HashMap原理
    高并发架构系列:MQ消息队列的12点核心原理总结
    大话程序员系列:一张图道尽程序员的出路
    java面试题
    SpringBoot框架的使用
    java开发定时任务执行时间
    OpenLayers 3 扩展插件收集
    Vue-cli webpack模板
    Spring的属性文件properties使用注意
    FullBg-网页图片背景自适应大小
  • 原文地址:https://www.cnblogs.com/xiaoit/p/3994092.html
Copyright © 2011-2022 走看看