linux篇-linux mysql5.6.27源码安装和错误解决

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: linux篇-linux mysql5.6.27源码安装和错误解决

centos

mysql5.6.27

1编译安装

先进入到文件放置的路径下

创建一个个文件

#mkdir–p /data/mysql/mysql

#mkdir–p /data/mysql/mysqldat

2创建用户和用户组

groupadd mysql

useradd -r -g mysql mysql

3赋予数据存放目录权限

chown mysql:mysql -R /data/mysql/mysqldata/

4解压

tar -xvf mysql-5.6.27.tar.gz

5安装cmake

yum -install cmake -y

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/mysql/data -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all  -DWITH_DEBUG=0 -DENABLED_LOCAL_INFILE=1

– Running cmake version 2.8.12.2

– Could NOT find Git (missing: GIT_EXECUTABLE)

– The C compiler identification is unknown

– The CXX compiler identification is unknown

CMake Error: your C compiler: “CMAKE_C_COMPILER-NOTFOUND” was not  found. Please set CMAKE_C_COMPILER to a valid compiler path or name.

CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not  found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

CMake Error at cmake/os/Linux.cmake:27 (STRING):

string sub-command REPLACE requires at least four arguments.

Call Stack (most recent call first):

CMakeLists.txt:149 (INCLUDE)

CMake Error at cmake/os/Linux.cmake:27 (STRING):

string sub-command REPLACE requires at least four arguments.

Call Stack (most recent call first):

CMakeLists.txt:149 (INCLUDE)

– MySQL 5.6.27

– Packaging as: mysql-5.6.27-Linux-i686

– Could NOT find Threads (missing: Threads_FOUND)

– Could NOT find Threads (missing: Threads_FOUND)

– Check if the system is big endian

– Searching 16 bit integer

CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:44 (message):

no suitable type found

Call Stack (most recent call first):

configure.cmake:628 (TEST_BIG_ENDIAN)

CMakeLists.txt:398 (INCLUDE)

– Configuring incomplete, errors occurred!

See also “/usr/local/src/mysql-5.6.27/CMakeFiles/CMakeOutput.log”.

See also “/usr/local/src/mysql-5.6.27/CMakeFiles/CMakeError.log”.

分析:

– Could NOT find Git (missing: GIT_EXECUTABLE)这项应该缺少git包,yum install -y git

– The C compiler identification is unknown

– The CXX compiler identification is unknown 这两项缺少gcc和gcc-c++的包,yum install -y gcc gcc-c++

另外需要rm CMakeCache.txt

继续

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/mysql/data -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all  -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1

出现错误:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:

OPENSSL_INCLUDE_DIR

used as include directory in directory /usr/local/src/mysql-5.6.27/CMakeFiles/CMakeTmp

CMake Error: Internal CMake error, TryCompile configure of cmake failed

– Check size of wchar_t - failed

– Check size of wctype_t

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:

OPENSSL_INCLUDE_DIR

used as include directory in directory /usr/local/src/mysql-5.6.27/CMakeFiles/CMakeTmp

CMake Error: Internal CMake error, TryCompile configure of cmake failed

– Check size of wctype_t - failed

– Check size of wint_t

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:

OPENSSL_INCLUDE_DIR

used as include directory in directory /usr/local/src/mysql-5.6.27/CMakeFiles/CMakeTmp

CMake Error: Internal CMake error, TryCompile configure of cmake failed

– Check size of wint_t - failed

– 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:409 (MYSQL_CHECK_EDITLINE)

– Configuring incomplete, errors occurred!

See also “/usr/local/src/mysql-5.6.27/CMakeFiles/CMakeOutput.log”.

See also “/usr/local/src/mysql-5.6.27/CMakeFiles/CMakeError.log”.

分析:

– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

缺少ncurses-devel包,yum install -y ncurses-devel

rm CMakeCache.txt

通过阅读官方文件http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html,去除选项-DWITH_READLINE=1和-DWITH_SSL=YES

重新

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/data/mysql -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all  -DWITH_DEBUG=0 -DENABLED_LOCAL_INFILE=1

出现warning:

– Running cmake version 2.8.12.2

– MySQL 5.6.27

– Packaging as: mysql-5.6.27-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

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

– Build files have been written to: /usr/local/src/mysql-5.6.27

分析:Warning: Bison executable not found in PATH 缺少Bison,yum install -y bison

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_DATADIR=/data/mysql -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all  -DWITH_DEBUG=0 -DENABLED_LOCAL_INFILE=1

echo $? 是0代表OK

6.make && make install

7.chown -R mysql:mysql /usr/local/mysql/

8.cd /usr/local/mysql/

9. ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 初始化

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

11. cp support-files/mysql.server /etc/init.d/mysqld

12. chmod 755 /etc/init.d/mysqld

13.vim /etc/init.d/mysqld 修改datadir=/data/mysql

14.service mysqld start

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

16mysql -u root -p没密码

成功启动Starting MySQL… SUCCESS!

image.png

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
10天前
|
关系型数据库 MySQL Linux
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
17 0
|
1月前
|
分布式计算 关系型数据库 MySQL
Sqoop【部署 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
【2月更文挑战第8天】Sqoop CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
93 1
|
2天前
|
存储 关系型数据库 MySQL
Linux | MySQL基础
Linux | MySQL基础
|
3天前
|
关系型数据库 MySQL Linux
Linux联网安装MySQL Server
Linux联网安装MySQL Server
13 0
|
1月前
|
关系型数据库 MySQL Linux
【Linux】在Linux上安装MySQL数据库的步骤
【Linux】在Linux上安装MySQL数据库的步骤
118 0
|
1月前
|
关系型数据库 MySQL Linux
【VMware安装+centos 7Linux系统+MySQL安装】——在Linux系统中安装MySQL步骤,以及遇见的各种问题(如:vm两个虚拟网卡消失、vm网络适配器有感叹号等等)
【VMware安装+centos 7Linux系统+MySQL安装】——在Linux系统中安装MySQL步骤,以及遇见的各种问题(如:vm两个虚拟网卡消失、vm网络适配器有感叹号等等)
178 0
|
1月前
|
关系型数据库 MySQL Linux
Linux服务器安装MySQL
Linux服务器安装MySQL
|
2月前
|
关系型数据库 MySQL Linux
Linux环境下定时备份mysql数据库
Linux环境下定时备份mysql数据库
|
2月前
|
关系型数据库 MySQL Linux
Linux环境安装mysql 5.6注意事项
Linux环境安装mysql 5.6注意事项
|
2月前
|
关系型数据库 MySQL Linux
MySQL 数据库安装详解(linux系统和windows系统)
MySQL 数据库是一种广泛使用的开源关系数据库管理系统。在 Linux 和 Windows 系统上安装 MySQL 数据库的步骤略有不同。
82 0