在 linux 上编译安装 mysql-5.6..tar.gz
http://www.mysql.com/
mysql下载地址:
http://www.mysql.com/downloads/mysql/#downloads
mysql 官方网站文档:
https://dev.mysql.com/doc/ 、准备工作 yum install -y gcc gcc-c++ cmake make ncurses ncurses-devel bison 、解压 tar zxf mysql-5.6..tar.gz 、编译 cmake . \
-DCMAKE_INSTALL_PREFIX=/tmp/test/mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_EXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci make -j 8
make install -j 8
注意:
常见的CMAKE选项
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql MySQL安装目录
-DWITH_INNOBASE_STORAGE_ENGINE= 安装InnoDB存储引擎
-DWITH_MYISAM_STORAGE_ENGINE= 安装MyISAM存储引擎
-DWITH_MEMORY_STORAGE_ENGINE= 安装内存存储引擎
-DDEFAULT_CHARSET=utf8 默认编码设置成utf8
-DDEFAULT_COLLATION=utf8_general_ci 默然校验规则是utf8_general_ci
-DWITH_EXTRA_CHARSETS=all 支持其他所有的编码
-DMYSQL_TCP_PORT= MySQL端口指定为3306
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 指定SOCK文件路径
-DMYSQL_DATADIR=/usr/local/mysql/data MySQL数据目录 make -j n 支持多线程编译(一般跟内核数相等) 、配置my.cnf
[root@rhel mysql]# pwd
/tmp/test/mysql
mkdir conf
cp support-files/my-default.cnf conf/
vim my.cnf 详情看下面的附属
、初始化数据库 useradd mysql
#注意 --user 需要用root编译
./scripts/mysql_install_db --defaults-file=/tmp/test/mysql/my.cnf --user=mysql ./scripts/mysql_install_db --defaults-extra-file=/tmp/test/mysql/conf/my.cnf --user=mysql 、启动数据库 ./bin/mysqld_safe --defaults-file=/tmp/test/mysql/my.cnf --user=mysql & ./bin/mysqld_safe --defaults-extra-file=/tmp/test/mysql/conf/my.cnf --user=mysql & 、设置密码
[root@rhel ~]# ss -ln |grep
LISTEN ::: :::* ./bin/mysqladmin -u root password '' 、账户授权 grant all on *.* to 'mvpbang'@'%' identified by '';
flush privileges; 、设置系统环境变量 vim /etc/profile
export PATH=$PATH://tmp/test/mysql/bin source /etc/profile
修改 rc.local ,让 mysql 开机自动运行
echo "mysqld_safe --defaults-extra-file=/tmp/test/mysql/conf/my.cnf --user=mysql &" >>/etc/rc.local 、基本命令的参数说明
[root@rhel mysql]# ./scripts/mysql_install_db --help
Usage: ./scripts/mysql_install_db [OPTIONS]
--basedir=path The path to the MySQL installation directory.
--builddir=path If using --srcdir with out-of-directory builds, you
will need to set this to the location of the build
directory where built files reside.
--cross-bootstrap For internal use. Used when building the MySQL system
tables on a different host than the target.
--datadir=path The path to the MySQL data directory.
If missing, the directory will be created, but its
parent directory must already exist and be writable.
--defaults-extra-file=name
Read this file after the global files are read.
--defaults-file=name Only read default options from the given file name.
--force Causes mysql_install_db to run even if DNS does not
work. In that case, grant table entries that
normally use hostnames will use IP addresses.
--help Display this help and exit.
--ldata=path The path to the MySQL data directory. Same as --datadir.
--no-defaults Don't read default options from any option file.
--keep-my-cnf Don't try to create my.cnf based on template.
Useful for systems with working, updated my.cnf.
Deprecated, will be removed in future version.
--random-passwords Create and set a random password for all root accounts
and set the "password expired" flag,
also remove the anonymous accounts.
--rpm For internal use. This option is used by RPM files
during the MySQL installation process.
--skip-name-resolve Use IP addresses rather than hostnames when creating
grant table entries. This option can be useful if
your DNS does not work.
--srcdir=path The path to the MySQL source directory. This option
uses the compiled binaries and support files within the
source tree, useful for if you don't want to install
MySQL yet and just want to create the system tables.
--user=user_name The login username to use for running mysqld. Files
and directories created by mysqld will be owned by this
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
Any other options are passed to the mysqld program. [root@rhel mysql]# ./bin/mysqld_safe --help
Usage: ./bin/mysqld_safe [OPTIONS]
--no-defaults Don't read the system defaults file
--defaults-file=FILE Use the specified defaults file
--defaults-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory
--open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
--timezone=TZ Set the system timezone
--malloc-lib=LIB Preload shared library LIB if available
--mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld
--plugin-dir=DIR Plugins are under DIR or DIR/VERSION, if
VERSION is given
--skip-kill-mysqld Don't try to kill stray mysqld processes
--syslog Log messages to syslog with 'logger'
--skip-syslog Log messages to error log (default)
--syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger' All other options are passed to the mysqld program.

附上my.cnf

[client]
default-character-set=utf8 [mysql]
auto-rehash
default-character-set=utf8 [mysqld]
#根据实际情况适当调整
innodb_buffer_pool_size = 128M
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M #个性化设置
lower_case_table_names= #忽略大小写
#对大批量数据导入导出防止超时
max_allowed_packet=500M
wait_timeout=
interactive_timeout= #数据库字符集设置(由于编译已经选择,顾不需要设置) #init_connect='SET collation_connection = utf8_unicode_ci'
#init_connect='SET NAMES utf8'
#character-set-server=utf8
#collation-server=utf8_unicode_ci #日志记录
#log_bin #基本信息
basedir = /tmp/test/mysql
datadir = /tmp/test/mysql/data
port =
server_id =
socket = /tmp/test/mysql/data/mysql.sock sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqld_safe]
log-error = /tmp/test/mysql/life.log
pid-file = /tmp/test/mysql/data/mysqld.pid

内核编译进度

注意:配置低的编译基本上都是1个小时左右!!!(一般建议放在服务器上编译开多线程)

linux上源码编译安装mysql-5.6.28的更多相关文章

  1. linux下源码编译安装mysql

    1.安装依赖的包: yum install -y gdb cmake ncurses-devel bison bison-devel 2.创建mysql安装目录和数据文件目录 mkdir -p /us ...

  2. Linux下源码编译安装MySql,centeros7

    1. 安cmake工具 # yum install -y cmake 2. 创建mysql用户  #useradd -s /sbin/nologin mysql  //设置为非登陆用户(安全) 3. ...

  3. Linux下源码编译安装MySQL 5.5.8

    准备工作: 新建用户和用户组 groupadd mysql useradd -g mysql mysql 1:下载: bison-2.4.2.tar.bz2 cmake-2.8.3.tar.gz ma ...

  4. CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境

    CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境 什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/ ...

  5. CentOS 6.6 下源码编译安装MySQL 5.7.5

    版权声明:转自:http://www.linuxidc.com/Linux/2015-08/121667.htm 说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# ...

  6. Linux 从源码编译安装 OpenSSH

    https://blog.csdn.net/bytxl/article/details/46639073 Linux 从源码编译安装 OpenSSH以及各问题解决 2015年06月25日 17:37: ...

  7. CentOS源码编译安装MySQL 5.5.15

    CentOS源码编译安装MySQL 5.5.15   文章目录 [隐藏] 安装编译工具 下载源码 安装cmake和bison 编译安装MySQL 一些相关设置 安装编译工具 yum install g ...

  8. Shell脚本一键部署——源码编译安装MySQL及自动补全工具

    Shell脚本一键部署--源码编译安装MySQL及自动补全工具 编译安装MySQL 1.软件包 Mysql安装包 将安装包拖至/opt目录下,编辑一个脚本文件,将以下内容复制进去,然后source或者 ...

  9. 总结源码编译安装mysql

    最近在学习源码编译安装LAMP.LNMP时,一直遇到一个难题,就是就是mysql无论怎么源码编译安装,到最后启动服务都提示"Starting MySQL.The server quit wi ...

随机推荐

  1. 测试 Java 类的非公有成员变量和方法

    引言 对于软件开发人员来说,单元测试是一项必不可少的工作.它既可以验证程序的有效性,又可以在程序出现 BUG 的时候,帮助开发人员快速的定位问题所在.但是,在写单元测试的过程中,开发人员经常要访问类的 ...

  2. Leetcode-841. 钥匙和房间

    题目 有 N 个房间,开始时你位于 0 号房间.每个房间有不同的号码:0,1,2,...,N-1,并且房间里可能有一些钥匙能使你进入下一个房间. 在形式上,对于每个房间 i 都有一个钥匙列表 room ...

  3. Valid Palindrome leetcode java

    题目: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ig ...

  4. Ajax核心技术之XMLHttpRequest

    Ajax:即"Asynchronous JavaScript and XML"(异步JavaScript和XML),一门综合性的技术:运用JavaScript对象XMLHttpRe ...

  5. 【Spark】Spark-foreachRDD需要注意的问题

    Spark-foreachRDD需要注意的问题 dstream.foreachRDD_百度搜索 通过Spark Streaming的foreachRDD把处理后的数据写入外部存储系统中 - 吾心光明 ...

  6. Spark简介及其在ubuntu下的安装使用

    转:http://blog.csdn.net/pelick/article/details/9888311 Spark概述 Spark是一种与 Hadoop 相似的开源集群计算环境,在性能和迭代计算上 ...

  7. UltraISO制作U盘启动盘安装Win7/9/10系统攻略

    U盘安装好处就是不用使用笨拙的光盘,光盘还容易出现问题,无法读取的问题.U盘体积小,携带方便,随时都可以制作系统启动盘. U盘建议选择8G及以上大小的. 下面一步一步讲解如果制作U盘安装盘: 1.首先 ...

  8. 怎样让孩子爱上设计模式 —— 7.适配器模式(Adapter Pattern)

    怎样让孩子爱上设计模式 -- 7.适配器模式(Adapter Pattern) 标签: 设计模式初涉 概念相关 定义: 适配器模式把一个类的接口变换成client所期待的还有一种接口,从而 使原本因接 ...

  9. android studio中的常用快捷键

    1.Ctrl+Alt+Space 这个类似Eclipse中的Alt+/,实现智能提示功能的 2.Ctrl+Y 删除当前行,Eclipse中是Ctrl+D,伤不起,每次都习惯性的按Ctrl+D,不删,反 ...

  10. Unity3d 屏幕截图。并保存。iOS

    - ( void ) imageSaved: ( UIImage *) image didFinishSavingWithError:( NSError *)error contextInfo: ( ...