MySQL入门01-MySQL源码安装
操作系统:CentOS 6.7
MySQL版本:5.6.30
1.前期准备
首先需要CMake,可以yum直接安装:
```
yum install cmake
```
也可以官网 https://cmake.org/ 下载源码编译。
我这里选择了官网下载最新版本cmake-3.5.2.tar.gz。
```
# tar -zxvf cmake-3.5.2.tar.gz && cd cmake-3.5.2
./configure
部分输出略。
-- Build files have been written to: /soft/cmake-3.5.2
CMake has bootstrapped. Now run gmake.
gmake
make install
<h1 id="2">2.系统配置</h1>
添加组和用户:
groupadd mysql
useradd -g mysql mysql
vi /etc/security/limits.conf 文件末尾添加:
mysql soft nproc 2047
mysql hard nproc 16384
mysql soft nofile 1024
mysql hard nofile 65536
<h1 id="3">3.CMake编译配置</h1>
解压源码包:
tar zxvf mysql-5.6.30.tar.gz && cd mysql-5.6.30
CMake编译配置
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DENABLED_LOCAL_INFILE=ON
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1
-DCOMPILATION_COMMENT='JSS for mysqltest'
-DWITH_READLINE=ON
-DSYSCONFDIR=/data/mysqldata/3306
-DMYSQL_UNIX_ADDR=/data/mysqldata/3306/mysql.sock
遇到以下错误,
-- 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:421 (MYSQL_CHECK_EDITLINE)
-- Configuring incomplete, errors occurred!
See also "/soft/mysql-5.6.30/CMakeFiles/CMakeOutput.log".
See also "/soft/mysql-5.6.30/CMakeFiles/CMakeError.log".
[root@JY-DB mysql-5.6.30]#
yum安装提示缺失的包:
yum install ncurses-devel
重新删除配置文件:
rm -rf CMakeCache.txt
然后重新CMake工具编译:
CMake Warning:
Manually-specified variables were not used by the project:
WITH_READLINE
-- Build files have been written to: /soft/mysql-5.6.30
[root@JY-DB mysql-5.6.30]#
<h1 id="4">4.make && make install</h1>
[root@JY-DB mysql-5.6.30]# make && make install
大量输出略。
这个时间会比较长,也跟机器性能有关。
<h1 id="5">5.后期配置和测试</h1>
## 5.1 打包MySQL二进制版本: ##
[root@JY-DB data]# tar zcvf mysql-5.6.30.tar.gz /usr/local/mysql/
## 5.2 修改MySQL软件所在目录拥有者: ##
chown -R mysql.mysql /usr/local/mysql
## 5.3 修改mysql用户环境变量: ##
vi ~/.bash_profile
export LANG=zh_CN.GB18030
export PATH=/usr/local/mysql/bin:$PATH
## 5.4 创建数据库服务: ##
mkdir -p /data/mysqldata/{3306/{data,tmp,binlog},backup,scripts}
chown -R mysql.mysql /data/mysqldata
su - mysql
$ more /usr/local/mysql/support-files/my-default.cnf
$ vi /data/mysqldata/3306/my.cnf
my.cnf配置文件内容如下:
[client]
port = 3306
socket = /data/mysqldata/3306/mysql.sock
The MySQL Server
[mysqld]
port = 3306
user = mysql
socket = /data/mysqldata/3306/mysql.sock
pid-file = /data/mysqldata/3306/mysql.pid
basedir = /usr/local/mysql
datadir = /data/mysqldata/3306/data
tmpdir = /data/mysqldata/3306/tmp
open_files_limit = 10240
explicit_defaults_for_timestamp
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Buffer
max_allowed_packet = 256M
max_heap_table_size = 256M
net_buffer_length = 8k
sort_buffer_size = 2M
join_buffer_size = 4M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
Log
log-bin = /data/mysqldata/3306/binlog/mysql-bin
binlog_cache_size = 32M
max_binlog_cache_size = 512M
max_binlog_size = 512M
binlog_format = mixed
log_output = FILE
log-error = ../mysql-error.log
slow_query_log = 1
slow_query_log_file = ../slow_query.log
general_log = 0
general_log_file = ../general_query.log
expire-logs-days = 14
InnoDB
innodb_data_file_path = ibdata1:2048M:autoextend
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_buffer_pool_size = 1024M
[mysql]
no-auto-rehash
prompt = (\u@\h)[\d]>_
default-character-set = gbk
初始化MySQL数据库:
$ /usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data --basedir=/usr/local/mysql
## 5.5 启动数据库服务: ##
mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf &
测试连接并查看MySQL进程和端口监听状态:
netstat -lnt | grep 3306
ps -ef | grep bin/mysql | grep -v grep
实际操作过程如下:
[root@JY-DB ~]# su - mysql
[mysql@JY-DB ~]$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.30-log JSS for mysqltest
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
(root@localhost)[(none)]> exit
Bye
[mysql@JY-DB ~]$ netstat -lnt |grep 3306
tcp 0 0 :::3306 ::
MySQL入门01-MySQL源码安装的更多相关文章
- MySQL学习之路 一 : MySQL 5.7.19 源码安装
MySQL 5.7.19 源码安装 查看系统: # cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 安装依赖包 # yum - ...
- mysql 在cento下源码安装
虚拟机改为网络地址转换 (NAT) service network restartping www.baidu.com rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm ...
- 数据库的硬迁移和mysql 5.5.38源码安装
场景:一台服务器出现了故障,需要把数据库迁移到另一台服务器上,由于数据效大,直接压缩数库的数据目录(在数据库DOWN的情况下)数据库版本mysql 5.5.38安装方式:源码安装思路:在另一台服务器上 ...
- LNMP架构下的nginx、mysql、php的源码安装
一.LNMP的介绍 LNMP就是Linux+Nginx+Mysql+Php这种网站服务架构.Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统,常见版本有:centos.ubun ...
- mysql 5.7.18 源码安装笔记
之所以贴出这样一篇笔记呢?主要是因为很久之前,源码安装MySQL的时候,碰到了太多太多的坎坷. 如果你有兴趣进行源码安装,那么请不要以这篇文章为标准,因为每个人的及其环境等其他因素还是差距比较大的. ...
- linux应用之Lamp(apache+mysql+php)的源码安装(centos)
Linux+Apache+Mysql+Php源码安装 一.安装环境: 系统:Centos6.5x64 Apache: httpd-2.4.10.tar.gz Mysql: mysql-5.6.20-l ...
- MySQL 5.6.26源码安装
5.6.26源码安装包:http://pan.baidu.com/s/1kUl44WRcmake安装包链接:http://pan.baidu.com/s/1c0LuwJA 操作系统版本:CentOS ...
- mysql 5.7.11 源码安装
mysql5.711安装 1.安装boost包下载地址http://sourceforge.net/projects/boost/files/boost/ 2.解压boost_1_59_0.tar.g ...
- mysql++ 3.2.3 源码安装
https://tangentsoft.com/mysqlpp/home 下载 wget https://tangentsoft.com/mysqlpp/releases/mysql++-3.2.3. ...
- MySQL 8.0.20 源码安装数据库软件
官方支持的平台: https://www.mysql.com/support/supportedplatforms/database.html
随机推荐
- input在标签内设置禁止输入空格
1.通过正则匹配解决问题 此处涉及\s:匹配任意空白符 \S:匹配任意非空白字符 <input type="text" onkeyup="this.value=t ...
- 1051. Pop Sequence
原题连接:https://www.patest.cn/contests/pat-a-practise/1051 题目: Given a stack which can keep M numbers a ...
- Oracle数据库操作
本例使用oracle数据库,使用PL/SQL可视化工具: --查询员工表数据 (emp为pl/sql自带的表,也可自己新建)select * from emp; --创建表空间create table ...
- redis 操作
redis 1 启动服务 redis-2.8.20 wangchengcheng$ pwd /Users/wangchengcheng/Documents/GameJelly/server/redis ...
- angularjs内置指令 - form
form类 angular js对form表单进行了那些扩展 ①html原生form表单不允许嵌套,而angular封装之后的form可以进行嵌套 ②angular为form扩展了自动校验,和防止重复 ...
- 火狐下white-space: nowrap对float的影响
- 在.NET Core中遭遇循环依赖问题"A circular dependency was detected"
今天在将一个项目迁移至ASP.NET Core的过程中遭遇一个循环依赖问题,错误信息如下: A circular dependency was detected for the service of ...
- JVM 备注
一.堆内存分布: JAVA 分为堆内存和栈内存,GC主要针对堆内存 1)Young: 存放新生内存对象 1.1)Eden JVM 刚开始分配的对象 1.2)Survivor1(from) 1.3)Su ...
- Python黑帽编程2.8 套接字编程
Python黑帽编程2.8 套接字编程 套接字编程在本系列教程中地位并不是很突出,但是我们观察网络应用,绝大多数都是基于Socket来做的,哪怕是绝大多数的木马程序也是如此.官方关于socket编程的 ...
- A*寻路算法
对于初学者而言,A*寻路已经是个比较复杂的算法了,为了便于理解,本文降低了A*算法的难度,规定只能横竖(四方向)寻路,而无法直接走对角线,使得整个算法更好理解. 简而言之,A*寻路就是计算从起点经过该 ...