环境
操作系统:CentoOS 6.7 x64
御马安装包:/opt/mysql-5.6.29.tar.gz
MySQL安装目录:/opt/yliyun/mysql
第一步 安装编译所需依赖
yum -y install wget bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel* cmake make
第二步 解压
cd /opt
tar zxf mysql-5.6.29.tar.gz
第三步 编译安装
cd /opt/mysql-5.6.29
cmake . \
-DCMAKE_INSTALL_PREFIX=/opt/yliyun/mysql \
-DMYSQL_DATADIR=/opt/yliyun/mysql/data \
-DINSTALL_LIBDIR=/opt/yliyun/mysql/lib \
-DINSTALL_PLUGINDIR=/opt/yliyun/mysql/plugin \
-DMYSQL_UNIX_ADDR=/opt/yliyun/mysql/data/mysql.sock \
-DSYSCONFDIR=/opt/yliyun/mysql/etc \
-DMYSQL_USER=root \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1
make
make install
第四步 初始化数据库
cd /opt/yliyun/mysql
scripts/mysql_install_db --user=root --datadir=/opt/yliyun/mysql/data
第五步 默认配置文件my.cnf
mkdir -pv /opt/yliyun/mysql/etc
cp -f /opt/yliyun/mysql/support-files/my-default.cnf /opt/yliyun/mysql/etc/my.cnf
修改 /opt/yliyun/mysql/etc/my.cnf内容,部分修改如下:
[mysqld]
innodb_buffer_pool_size = 128M
log_bin=mysql-bin
expire-logs-days=30
binlog-do-db=yliyun
binlog-do-db=yliyun_log
binlog-ignore-db=test
basedir = /opt/yliyun/mysql
datadir = /opt/yliyun/mysql/data
port = 3306
server_id = 1
socket = /opt/yliyun/mysql/data/mysql.sock
user = root
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
key_buffer_size = 16M
max_allowed_packet = 8M
table_open_cache = 64
skip-name-resolve
innodb_file_per_table = 1
innodb_log_file_size = 16M
innodb_log_buffer_size = 4M
slow_query_log_file = /opt/yliyun/mysql/logs/slowquery.log
slow_query_log = 1
long_query_time = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/opt/yliyun/mysql/logs/mysql-error.log
第六步 配置开机启动
mkdir -pv /var/lock/subsys/mysql
cp -f /opt/yliyun/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
修改/etc/rc.d/init.d/mysqld中如下内容:
basedir=/opt/yliyun/mysql
datadir=$basedir/data
mysqld_pid_file_path="$datadir/mysql.pid"
配置开机启动
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
service mysqld start
第七步 设置root管理员密码
/opt/yliyun/mysql/bin/mysqladmin -u root password "root密码"
第八步 删除空密码账户
mysql/bin/mysql -uroot -p -e "use mysql; delete from user where password='';"
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。