#基础环境
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
#添加用户
Groupadd MySQL
Useradd-r-G MySQL MySQL
#下载源码包
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz
#解压
Tar zxvf mysql-5.6.16.tar.gz && CD mysql-5.6.16
# #cmake编译:
CMake \
-dcmake_install_prefix=/opt/mysql \
-dmysql_datadir=/opt/mysql/data \
-DSYSCONFDIR=/ETC \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-dmysql_unix_addr=/tmp/mysql3306.sock \
-dmysql_tcp_port=3306 \
-denabled_local_infile=1 \
-dwith_partition_storage_engine=1 \
-dextra_charsets=all \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci
State:
CMake Warning (Dev) in Sql/cmakelists.txt:
Policy CMP0022 is not set:interface_link_libraries defines the LINK
Interface. Run "CMake--help-policy CMP0022" for policy details. Use the
Cmake_policy command to set the policy and suppress this warning.
Target "Mysqld" has a interface_link_libraries property which differs from
Its link_interface_libraries properties.
Interface_link_libraries:
-lpthread;sql;binlog;rpl;master;slave;sql;mysys;mysys_ssl
Link_interface_libraries:
Rt
This warning are for project developers. Use-wno-dev to suppress it.
--Generating done
CMake Warning:
Manually-specified variables were not used by the project:
With_memory_storage_engine
With_readline
--Build files has been written to:/root/mysql-5.6.16
Note: This cmake is an alternative to the previous./configure step. If you need more parameters, please refer to http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html.
Make && make install
Installing the Database
Cd/opt/mysql/scripts
./mysql_install_db--user=mysql--basedir=/opt/mysql--datadir=/opt/mysql/data
Register as a service
Cd/opt/mysql/support-files
############## #注册服务
CP Mysql.server/etc/rc.d/init.d/mysql
#使用默认配置文件
CP MY-DEFAULT.CNF/ETC/MY.CNF
#让chkconfig管理mysql服务
Chkconfig--add MySQL
#开机启动
Chkconfig MySQL on
Assigning permissions to the data store directory
# chown Mysql:mysql–r/opt/mysql/data
########### #启动MySQL服务
Service MySQL Start
############### #改变编码 to prevent garbled characters
SHOW VARIABLES like ' character% '
Modify the MySQL my.cnf file
[Client]
Default-character-set=utf8
[Mysqld]
Character-set-server=utf8
[MySQL]
Default-character-set=utf8
############ #将mysql的bin加入到path中
CD ~
#我把path添加到当前用户目录的bashrc中, if global settings are required, modify '/etc/profile '
VI. BASHRC
#加入以下内容
Path=/usr/local/mysql/bin: $PATH
Export PATH
Soft Connect to/usr/bin
Ln-s/opt/mysql/bin/mysql/usr/bin/
Configure user passwords and remote access permissions
Mysql-uroot
Use MySQL
SET PASSWORD = PASSWORD (' 123456 ');
GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
This article from "My Sky" blog, declined reprint!
mysql5.6.16 deployment