MySQL5.7源码安装问题汇总

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

       编译安装mysql5.7版本,想试用一下新的版本特性,发现跟之前的5.6版本编译有了一些变化,总结一下避免以后继续入坑。5.6安装方式

cmake版本

5.7编译cmake要求版本最低为2.8,当前为2.6,所以需要升级cmake版本。信息如下

1
2
3
4
5
6
7
shell> cmake . -DCMAKE_INSTALL_PREFIX=/db/mysql/mysql_57 -DMYSQL_DATADIR=/db/mysql/mysql_57/data
CMake Error at CMakeLists.txt:21 (CMAKE_MINIMUM_REQUIRED):
   CMake 2.8.2 or higher is required.  You are running version 2.6.4
-- Configuring incomplete, errors occurred!
 
shell> cmake --version
cmake version 2.6-patch 4

cmake官网下载地址

1
2
3
4
5
6
7
shell> tar zxvf cmake-3.2.2.tar.gz
shell> cd cmake-3.2.2/
shell> ./bootstrap
shell> make && make install
 
shell> cmake --version
cmake version 3.2.2

BOOST库

5.7编译需要boost类库,可使用 -DDOWNLOAD_BOOST=1 -DWITH_BOOST= 参数将在指定路径查找,如未找到会指

定下载并解压到指定的路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
问题描述
shell> cmake . -DCMAKE_INSTALL_PREFIX=/db/mysql/mysql_57 -DMYSQL_DATADIR=/db/mysql/mysql_57/data 
 
CMake suite maintained and supported by Kitware (kitware.com/cmake).
 
 
-- Could not find (the correct version of) boost.
-- MySQL currently requires boost_1_57_0
 
CMake Error at cmake/boost.cmake:76 (MESSAGE):
   You can download it  with  -DDOWNLOAD_BOOST=1 -DWITH_BOOST=安装boost库
shell> tar jxvf boost_1_57_0.tar.bz2
shell> cd boost_1_57_0/
shell> ./bootstrap.sh
shell> ./b2 install
 
安装后目录
shell> ls /usr/local/include/
boost
 
shell> cmake . -DCMAKE_INSTALL_PREFIX=/db/mysql/mysql_57 -DMYSQL_DATADIR=/db/mysql/mysql_57/data


mysql_install_db

之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目录下,且已被废弃。

1
2
3
4
5
6
7
8
9
10
11
shell> cd /db/mysql/mysql_57
shell> bin/mysql_install_db --basedir=. --datadir=data --user=mysql
[WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
 
shell> bin/mysqld --initialize
2015-04-21T18:17:53.169216Z 0 [Warning] TIMESTAMP  with  implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation  for  more details).
2015-04-21T18:17:58.702510Z 0 [Warning] InnoDB: New log files created, LSN=45790
2015-04-21T18:17:59.538811Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-04-21T18:17:59.646010Z 0 [Warning] Failed to setup SSL
2015-04-21T18:17:59.646105Z 0 [Warning] SSL error: SSL context is not usable without certificate and private key
2015-04-21T18:17:59.663795Z 1 [Warning] A temporary password is generated  for  root@localhost: rq/Oh8VWs1Yh

mysql5.7的数据库初始化如下:


1
shell>/usr/local/mysql/bin/mysqld  --initialize --user=mysql --basedir=/usr/local/mysql/  --datadir=/usr/local/mysql/data/

初始化密码

mysql5.7会生成一个初始化密码,而在之前的版本首次登陆不需要登录。

1
2
3
4
5
6
7
8
shell> cat /root/.mysql_secret 
# Password set for user 'root@localhost' at 2015-04-22 22:13:23 
?G5W&tz1z.cN
 
修改默认密码
shell> bin/mysqladmin -h localhost -u root password  '123@qwe'  -p '?G5W&tz1z.cN'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server  in  plain text, use ssl connection to ensure password safety.

另外mysql5.7的mysql.user表结构被修改

1
2
3
4
5
6
7
修改mysql.user方式修改密码
mysql> update mysql.user set authentication_string=password( '123qwe' ) where user= 'svoid'  and Host =  'localhost' ;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


整理自:http://blog.itpub.net/29733787/viewspace-1590891/







      本文转自MQ_douer 51CTO博客,原文链接:http://blog.51cto.com/douer/1922603,如需转载请自行联系原作者




相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
348
分享
相关文章
【MYSQL】—— MySQL 在 Centos 7环境安装
【MYSQL】—— MySQL 在 Centos 7环境安装
346 0
MySQL源码安装
mysql是一个开源的关系型数据库管理系统,现在是oracle公司旗下的一款产品,由C和C++语言编写,可移植性高。 支持在多种操作系统上安装,最常见有AIX,linux,window。mysql因为开源免费,所以受到了目前互联网行业的 欢迎。 以mysql作为数据库,linux系统作为操作系统,apache或者nginx作为web服务器,perl/php/python作为服务 端的脚本解释器,就可以搭建起一个免费的网站。被业界称为LNMP或者LAMP
274 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等