Mysql-5.6安装编译全教程

Mysql安装编译

一 cmake-3.0.2编译

yum install gcc-c++

yum install ncurses-devel

tar xf  cmake-3.0.2.tar.gz

cd cmake-3.0.2

./configure --prefix=/usr/local/cmake3.0.2 && make && make install

vi /etc/profile   // 修改环境变量

#在文件末尾追加以下两行代码:

PATH=/usr/local/cmake3.0.2/bin:$PATH

export PATH

source /etc/profile   //使修改生效

echo $PATH   //查看PATH值

cmake --version //查看是否安装成功

二 jemalloc-3.6.0编译

yum install gcc gcc-c++ cmake ncurses-devel bison

tar xf jemalloc-3.6.0.tar.bz2

cd jemalloc-3.6.0

./configure

make

make install

echo ‘/usr/local/lib‘ > /etc/ld.so.conf.d/local.conf

ldconfig

三 mysql5.6.21编译

useradd -M -s /sbin/nologin mysql

mkdir -p /mysql/data

chown mysql.mysql -R /mysql/data

tar xf mysql-5.6.21.tar.gz

cd mysql-5.6.21

make clean

/usr/local/cmake3.0.2/bin/cmake . -DCMAKE_INSTALL_PREFIX="/mysql/mysql" -DMYSQL_DATADIR="/mysql/data" -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EMBEDDED_SERVER=1 -DCMAKE_EXE_LINKER_FLAGS=‘-ljemalloc‘ && make && make install

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

chmod +x /etc/init.d/mysql

chkconfig --add mysql # chkconfig中增加启动项名称

chkconfig mysql on

cat > /etc/my.cnf << EOF----------------------------仅供参考

[client]

port = 3306

socket = /tmp/mysql.sock

[mysqld]

port = 3306

socket = /tmp/mysql.sock

basedir = /mysql/mysql

datadir = /mysql/data

pid-file = /mysql/data/mysql.pid

user = mysql

bind-address = 0.0.0.0

server-id = 1

skip-name-resolve

#skip-networking

back_log = 300

max_connections = 1000

max_connect_errors = 6000

open_files_limit = 65535

table_open_cache = 128

max_allowed_packet = 4M

binlog_cache_size = 1M

max_heap_table_size = 8M

tmp_table_size = 16M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

sort_buffer_size = 8M

join_buffer_size = 8M

key_buffer_size = 4M

thread_cache_size = 8

query_cache_type = 1

query_cache_size = 8M

query_cache_limit = 2M

ft_min_word_len = 4

log_bin = mysql-bin

binlog_format = mixed

expire_logs_days = 30

log_error = /mysql/data/mysql-error.log

slow_query_log = 1

long_query_time = 1

slow_query_log_file = /mysql/data/mysql-slow.log

performance_schema = 0

explicit_defaults_for_timestamp

#lower_case_table_names = 1

skip-external-locking

default_storage_engine = InnoDB

#default-storage-engine = MyISAM

innodb_file_per_table = 1

innodb_open_files = 500

innodb_buffer_pool_size = 64M

innodb_write_io_threads = 4

innodb_read_io_threads = 4

innodb_thread_concurrency = 0

innodb_purge_threads = 1

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 2M

innodb_log_file_size = 32M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 120

bulk_insert_buffer_size = 8M

myisam_sort_buffer_size = 8M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

interactive_timeout = 28800

wait_timeout = 28800

[mysqldump]

quick

max_allowed_packet = 16M

[myisamchk]

key_buffer_size = 8M

sort_buffer_size = 8M

read_buffer = 4M

write_buffer = 4M

EOF

----------------------------------------------------

五、初始化和安全性

初始化数据库:

/mysql/mysql/scripts/mysql_install_db --user=mysql --basedir=/mysql/mysql --datadir=/mysql/data

除去隐患:

grant all privileges on *.* to [email protected]‘127.0.0.1‘ identified by "123456" with grant option;

grant all privileges on *.* to [email protected]‘localhost‘ identified by "123456" with grant option;

delete from mysql.user where Password=‘‘;

delete from mysql.db where User=‘‘;

delete from mysql.proxies_priv where Host!=‘localhost‘;

drop database test;

reset master;

#删除所有index file 中记录的所有binlog 文件,将日志索引文件清空,创建一个新的日志文件,这个命令通常仅仅用于第一次用于搭建主从关系的时的主库,

最后一步:

export PATH=/mysql/mysql/bin:$PATH #增加环境变量

或PATH=/mysql/mysql/bin:$PATH

export PATH

启动mysql,操作试试吧:

mysql -uroot -p

时间: 2024-11-18 15:30:03

Mysql-5.6安装编译全教程的相关文章

macOS下MySQL 8.0 安装与配置教程

原文:macOS下MySQL 8.0 安装与配置教程 一.前言 1.本教程主要内容 适用Homebrew安装MySQL MySQL 8.0 基础适用于配置 MySQL shell管理常用语法示例(用户.权限等) MySQL字符编码配置 MySQL远程访问配置 2.本教程环境信息与适用范围 环境信息 软件/环境 版本/说明 macOS macOS High Sierra MySQL MySQL 8.0.12 适用范围 软件 版本 macOS macOS MySQL 8.0.x 二.MySQL安装

源码编译mysql 5.5+ 安装过程全记录

前言:从mysql 5.5版本开始,mysql源码安装开始使用cmake了,编译安装跟以前的版本有点不一样了. 一,安装步骤: 1.安装前准备工作 a.下载mysql源代码包,到mysql下载页面选择MYSQL Community Serve Source Code 版本 注意:不要选择Linux-Generic版本,此版本为已经编译好的二进制版本 b.检查本机Linux是否已安装好make,bison,cmake,gcc-c++,ncurses,如果尚未安装,先安装以上包,安装方法如下: 注意

Centos MySQL 5.7安装、升级教程

MySQL 5.7安装.升级笔记分享: 卸载当前的 MySQL 查看当前 MySQL 版本: ? 1 2 [[email protected] ~]# mysql -V mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (i386) using readline 5.1 停止 MySQL 服务 ? 1 2 [[email protected] ~]# service mysqld stop Stopping mysqld:      [ O

Mysql Proxy的安装配置详细教程

8.12.1.1 Mysql Proxy的安装 安装需要的基础组件,基本系统都可以满足lua的组件版本要求 安装lua(确定是否需要安装)yum -y install gcc gcc-c++ autoconf automake zlib libxml ncurses-devel libmc rypt libtool flex pkgconfig glib* readline-devel libevent-devel ? 安装glibhttp://ftp.gnome.org/pub/gnome/s

原有MySQL数据库 ,安装多实例教程

#mysql安装脚本安装好后 mkdir -v /usr/share/mysql/mysql-files mkdir -vp /data/mysql_data{1..4} * 修改 MySQL 二进制包目录的所属用户与所属组 chown root.mysql -R /usr/share/mysql * 修改 MySQL 多实例数据目录与 数据导入/导出专放目录的所属用户与所属组 chown mysql.mysql -R /usr/share/mysql/mysql-files /data/mys

MySQL 绿色版安装方法图文教程

一.下载,这里使用绿色解压缩版 http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-noinstall-5.1.32-win32.zip 二.配置MySQL的参数 1.解压缩绿色版软件到D:\AppServ\MySQL设置系统环境变量, 在Path中添加 D:\AppServ\MySQL\bin; 2.修改D:\AppServ\MySQL\my-small.ini文件内容,添加红色内容 [client]#password

CentOS6、7安装MySQL5.7全教程

CentOS6.7安装MySQL5.7全教程 做开发总得用到数据吧,Linux作为服务器,总得有一个数据库来存储测试用的数据,所以呢,这里附上CentOS6.7安装MySQL5.7的教程喔~ 用到的工具:CentOs6.7:Mysql依赖包 Step1. 查看已安装的mysql: # yum list installed | grep mysql mysql-libs.x86_64 5.1.71-1.el6 @anaconda-CentOS-201311272149.x86_64/6.5 卸载当

转 mysql front安装与使用教程 mysql 工具

mysql front安装与使用教程 由 kaikai0220 创建,Alma 最后一次修改 2018-04-25 mysql front一款小巧的管理Mysql的应用工具,那么这个工具该如何安装和使用呢?一起来看看吧. 一.mysql front下载: mysql front下载地址:点击下载 二.mysql front安装 1.点击下载的MySQL-Front_Setup.exe程序,开始安装,出现以下界面: 2.点击"下一步",出现以下界面: 3.点击"浏览"

【MySQL】源码编译安装和配置MySql 5.5.32(单实例)

[需求描述] 在CentOS环境中,通过编译源码的方式,安装并且配置“单实例”的MySQL5.5.32数据库. MySQL的安装目录为:/application/mysql-5.5.32 MySQL数据文件的安装目录为:/application/mysql-5.5.32/data MySQL默认的字符编码为:UTF8 [环境参数] VMware:10.0.1 Host:Win7 DB:MySql 5.5.32 编译工具:cmake-2.8.8.tar.gz 其他依赖:ncurses-devel-