One: Compiling MySQL
Useradd-m-s/sbin/nologin MySQL #创建mysql用户
Yum-y Install CMake #安装cmake
Tar zxvf mysql-5.5.22.tar.gz #解压mysql源码包
Cmake-dcmake_install_prefix=/usr/local/mysql-dsysconfdir=/etc-ddefault_charset=utf8-ddefault_collation=ut F8_general_ci-dwith_extra_charsets=all #配置mysql编译参数
make #编译
Make install #安装mysql
Two: Initialize MySQL
Chown-r Mysql:mysql/usr/local/mysql #修改mysql目录属主
Ln-s/usr/local/mysql/bin/*/usr/local/bin #创建命令链接
CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF #复制配置文件
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld #复制启动脚本
chmod +x/etc/init.d/mysqld #赋予执行权限
/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data #初始化
Description of initialization parameters:
--user: Specify the program user for MySQL
--basedi: Specify MySQL's home directory
--datadir: Specifying the MySQL database directory
Service mysqld Start #启动mysql
Three: Common compilation parameters
-dcmake_install_prefix=/usr/local/mysql #指定安装目录
-dmysql_datadir=/usr/local/mysql/data #指定数据库存放目录
-dsysconfdir=/etc #指定mysql配置文件
-ddefault_charset=utf8 #使用utf8字符
-ddefault_collation=utf8_general_ci #校验字符
-dextra_charsets=all #安装额外的编码集
-dwith_myisam_storage_engine=1 #安装 MYISAM Storage Engine
-dwith_innobase_storage_engine=1 #安装 InnoDB storage Engine
-dwith_archive_storage_engine=1 #安装 ARCHIVE Storage Engine
-dwith_blackhole_storage_engine=1 #安装 blackhole Storage Engine
-denabled_local_infile=1 #允许从本地导入数据
-dmysql_tcp_port=3306 #MySQL listening port
-dmysql_user=mysql #MySQL user name
-dwith_ssl=yes #SSL
-dwith_memory_storage_engine=1 #安装 memory storage Engine
-dwith_federated_storage_engine=1 #安装 frderated Storage Engine
-dinstall_plugindir=/usr/local/mysql/plugin#插件文件及配置路径
This article is from the "Automated Operations" blog, please be sure to keep this source http://hongchen99.blog.51cto.com/12534281/1931761
MySQL Basics (i) Compile and install mysql5.5