• 学以致用十六-----Centos7.2编译安装mysql5.6.22


    一、系统环境

    二、卸载系统自带的mariadb

    rpm -qa | grep db

    rpm -e --nodeps mariadb-libs-5.5.60

    rpm -e --nodeps mariadb-devel-5.5.60

     三、安装依赖包

    yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git lsof

    yum -y  install ncurses-devel

    yum install -y perl-Module-Build.noarch

    四、安装cmake   3.0以上

    cmake 3.12.2

    ./configure

    gmake  

    make install

    五、创建用户

    useradd  mysql

    六、创建mysql需要的目录

    mkdir /usr/local/mysql

    mkdir /var/lib/mysql

     七、安装mysql

    cmake -DCMAKE_INSALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc

    make ; make install

    八、设置配置文件

    cp /usr/local/mysql/support-files/my-default.cnf  /etc/my.cnf

    九、初始化数据库

    #cd /usr/local/mysql/scripts
    # ./mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql

    十、配置环境变量

    #vi /etc/profile
    PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
    #export PATH
    #source /etc/profile

    十一、设置mysql用户权限

    chown -R mysql:mysql /var/lib/mysql

    十二、启动mysql

    service mysql start

    十三、设置mysql密码

    mysql> use mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed
    mysql> update user set password=PASSWORD('root') where user='root';
    Query OK, 4 rows affected (0.03 sec)
    Rows matched: 4 Changed: 4 Warnings: 0
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    十四、设置mysql快捷方式

    ln -s /usr/local/mysql/bin/mysql /usr/bin

    至此mysql 安装完毕。

    =================================================================================

    安装过程中,遇到的错误

    a、如果没有安装  ncurses-devel

    会报错

    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
    > -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc
    报错啦
    -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
    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:406 (MYSQL_CHECK_EDITLINE)

    解决方法 : 根据蓝色色体提示 安装 ncurses-devel
    rm -rf CMakeCache.txt
    yum install ncurses-devel

    b、初始化数据库报错

    #cd /usr/local/mysql/scripts
    # ./mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql
    ****************************************************************************************************************************
    * 初始化报错 *
    * [root@ip-172-31-26-112 scripts]# ./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/var/lib/mysql *
    * FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db: *
    * Data::Dumper *
    *****************************************************************************************************************************
    提示没有perl-modules
    解决:
    yum list | grep -i perl-modul*
    yum install -y perl-Module-Build.noarch

  • 相关阅读:
    ASP.NET Core 问题排查:Request.EnableRewind 后第一次读取不到 Request.Body
    解决 AutoMapper ProjectTo 不起作用的问题
    解决 ASP.NET Core 自定义错误页面对 Middleware 异常无效的问题
    ASP.NET Core 从 gitlab-ci 环境变量读取配置
    终于解决 xUnit.net 测试中无法输出到控制台的问题
    ASP.NET Core 新建线程中使用依赖注入的问题
    前端回顾:2016年 JavaScript 之星
    前端工程师和设计师必读文章推荐【系列三十五】
    AsciiMorph
    Notyf
  • 原文地址:https://www.cnblogs.com/liongong/p/9704150.html
Copyright © 2020-2023  润新知