# 请在之前的文章.参照操作系统安装方法.
# 安装方法不同,可能会导致无法成功编译安装mysql.
# 编译安装的方法
# 使用yum安装bison
# 下载地址
# mysql 下载地址 官网的列表 需要自己去选择
# http://dev.mysql.com/downloads/mirrors.html
# cmake 下载地址 官网的列表 需要自己去选择
# http://www.cmake.org/cmake/resources/software.html
# 下载mysql 和 cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
# 解压
tar zxf mysql-5.5.18.tar.gz
# 进入cmake 目录
# 编译 安装
[/cce_bash]
./configure && make && make install
cd ../
[/cce_bash]
# 进入mysql 目录
# 使用 cmake 编译
-DCMAKE_INSTALL_PREFIX=/soft/mysql-5.5.18 \
-DMYSQL_DATADIR=/data/mysql-5.5.18/ \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_EXTRA_CHARSETS=complex \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_unicode_ci \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1
# 编译 安装
# 建立mysql组
# 建立mysql用户并加入到mysql组
# 建立数据路径
# 修改目录权限
# 复制配置文件到/etc目录
# 复制服务文件到 /etc/init.d目录
chmod +x /etc/init.d/mysqld
# 增加mysql 路径到 /etc/profile 目录 (功能是增加环境变量)
# 重读 profile 让环境变量立刻生效
# 初始化数据库
# 开启mysql
# 清理MYSQL默认数据
# 清除主机名相关默认用户
# 清除主机默认IP地址相关默认用户
# 清除localhost相关默认用户
# 修改mysql root 密码为 123456
# 将mysql 加入服务
# 设置启动
# 重启mysql
————————————–以下为说明和一些介绍———————————
———————1
TYPE=MyISAM 与ENGINE=MyISAM 的区别
TYPE=MyISAM 和 ENGINE=MyISAM 都是设置数据库存储引擎的语句
MySQL 5.1为向下兼容而支持这个语法,但TYPE现在被轻视,而ENGINE是首先的用法。
一般地,ENGINE 选项是不必要的;除非默认已经被改变了,MyISAM是默认存储引擎。
如果使用Navicat 要使用高版本
如果Navicat< 8.0 建立表可能会报错
———————2
该 版本一个最大的改动就是增加了性能的元数据信息库,数据库名为 performance_schema ,采用的存储引擎是 PERFORMANCE_SCHEMA,该数据库将会记录数据库性能相关的一些数据信息。关于 performance_schema 的更多信息请看 Chapter 20, MySQL Performance Schema。
另外该数据库并不是默认启用的,需要在启动服务的时候指定 –performance_schema 参数。
mysql 5.5 新特性及修改内容
http://dev.mysql.com/doc/refman/5.5/en/mysql-nutshell.html
———————3
如果不单独的加入 表引擎选项
默认情况
| CSV | YES | CSV storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
编译加入了
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| CSV | YES | CSV storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
———————4
— 打开sql执行记录功能
set global log_output=’TABLE’; — 输出到表
set global log=ON; — 打开所有命令执行记录功能general_log, 所有语句: 成功和未成功的.
set global log_slow_queries=ON; — 打开慢查询sql记录slow_log, 执行成功的: 慢查询语句和未使用索引的语句
set global long_query_time=0.1; — 慢查询时间限制(秒)
set global log_queries_not_using_indexes=ON; — 记录未使用索引的sql语句
— 查询sql执行记录
select * from mysql.slow_log order by 1; — 执行成功的:慢查询语句,和未使用索引的语句
select * from mysql.general_log order by 1; — 所有语句: 成功和未成功的.
— 关闭sql执行记录
set global log=OFF;
set global log_slow_queries=OFF;
— long_query_time参数说明
— v4.0, 4.1, 5.0, v5.1 到 5.1.20(包括):不支持毫秒级别的慢查询分析(支持精度为1-10秒);
— 5.1.21及以后版本 :支持毫秒级别的慢查询分析, 如0.1;
— 6.0 到 6.0.3: 不支持毫秒级别的慢查询分析(支持精度为1-10秒);
— 6.0.4及以后:支持毫秒级别的慢查询分析;
———————5
cmake 和 configure的对比
注意 由于内容过长 排版不是很顺畅 不同字段用 “|” 分割
configure Command |CMake Command
./configure |cmake .
./configure –help |cmake . -LH or ccmake .
安装选项
Parameter |configure Option |CMake Option |CMake Notes
Installation base directory |–prefix=/usr |-DCMAKE_INSTALL_PREFIX=/usr |
mysqld directory |–libexecdir=/usr/sbin |-DINSTALL_SBINDIR=sbin |interpreted relative to prefix
Data directory |–localstatedir=/var/lib/mysql |-DMYSQL_DATADIR=/var/lib/mysql |
Config directory (for my.cnf) |–sysconfdir=/etc/mysql |-DSYSCONFDIR=/etc/mysql |
Plugin directory |–with-plugindir=/usr/lib64/mysql/plugin |-DINSTALL_PLUGINDIR=lib64/mysql/plugin |interpreted relative to prefix
Man page directory |–mandir=/usr/share/man |-DINSTALL_MANDIR=share/man |interpreted relative to prefix
Shared-data directory |–sharedstatedir=/usr/share/mysql |-DINSTALL_SHAREDIR=share |this is where aclocal/mysql.m4 should be installed
Library installation directory |–libdir=/usr/lib64/mysql |-DINSTALL_LIBDIR=lib64/mysql |interpreted relative to prefix
Header installation directory |–includedir=/usr/include/mysql |-DINSTALL_INCLUDEDIR=include/mysql |interpreted relative to prefix
Info doc directory |–infodir=/usr/share/info |-DINSTALL_INFODIR=share/info |interpreted relative to prefix
# 存储引擎选项 注:mysql 5.5.x 中InnoDB作为默认的数据库存储引擎举例如下 开启 该数据引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOE_STORAGE_ENGINE=1
关闭 该数据引擎-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1-DWITHOUT_FEDERATED_STORAGE_ENGINE=1-DWITHOUT_PARTITION_STORAGE_ENGINE=1
lib选项
Parameter |configure Option |CMake Option |CMake Notes
readline library |–with-readline |-DWITH_READLINE=1 |
SSL library |–with-ssl=/usr |-DWITH_SSL=system |
zlib library |–with-zlib-dir=/usr |-DWITH_ZLIB=system |
libwrap library |–without-libwrap |-DWITH_LIBWRAP=0 |
其他选项
Parameter |configure Option |CMake Option |CMake Notes
TCP/IP port number |–with-tcp-port-=3306 |-DMYSQL_TCP_PORT=3306 |
UNIX socket file |–with-unix-socket-path=/tmp/mysqld.sock |-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock |
Enable LOCAL for LOAD DATA |–enable-local-infile |-DENABLED_LOCAL_INFILE=1 |
Extra charsets |–with-extra-charsets=all |-DEXTRA_CHARSETS=all |default is “all”
Default charset |–with-charset=utf8 |-DDEFAULT_CHARSET=utf8 |
Default collation |–with-collation=utf8_general_ci |-DDEFAULT_COLLATION=utf8_general_ci |
Build the server |–with-server |none |
Build the embedded server |–with-embedded-server |-DWITH_EMBEDDED_SERVER=1 |
libmysqld privilege control |–with-embedded-privilege-control |none |always enabled?
Install the documentation |–without-docs |none |
Big tables |–with-big-tables, –without-big-tables |none |tables are big by default
mysqld user |–with-mysqld-user=mysql |-DMYSQL_USER=mysql |mysql is the default
Debugging |–without-debug |-DWITH_DEBUG=0 |default is debugging disabled
GIS support |–with-geometry |none |always enabled?
Community features |–enable-community-features |none |always enabled
Profiling |–disable-profiling |-DENABLE_PROFILING=0 |enabled by default
pstack |–without-pstack |none |pstack is removed
Assembler string functions |–enable-assembler |none |
Build type |–build=x86_64-pc-linux-gnu |no equivalent |unneeded?
Cross-compile host |–host=x86_64-pc-linux-gnu |no equivalent |unneeded?
Client flag |–with-client-ldflags=-lstdc++ |none |unneeded
Client flag |–enable-thread-safe-client |none |unneeded, clients are always thread safe
Comment |–with-comment=’string’ |-DWITH_COMMENT=’string’ |
Shared/static binaries |–enable-shared –enable-static |none |there is only DISABLE_SHARED
Memory use |–with-low-memory |none |unneeded
cmake 日志存放位置
CMakeFiles/CMakeError.log
CMakeFiles/CMakeOutput.log
清理编译参数
make clean
rm CMakeCache.txt
- 本文固定链接: http://www.sa-log.com/83.html
- 转载请注明: 王, 帅 于 我的系统记录 发表