码迷,mamicode.com
首页 > 数据库 > 详细

mysql5.6 通用二进制安装

时间:2016-09-22 01:01:24      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:

 

mysql5.6 通用二进制安装:

#卸载原有的mysql
yum remove mysql*
ls /etc/my.cnf*
mv /etc/my.cnf* /tmp/

#安装依赖包
yum install make cmake gcc gcc-c++ bison-devel ncurses-devel autoconf automake -y

#添加用户
groupadd mysql
useradd -r -g mysql mysql
#useradd -M -s /sbin/nologin mysql

#创建目录
mkdir -p /usr/local/mysql
mkdir -p /home/mysql
mkdir -p /home/data
mkdir -p /home/mysql/logs
mkdir -p /home/mysql/temp


#添加环境变量
echo ‘PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH‘ >>/etc/profile
source /etc/profile

cd /soft/
tar xf mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
cd mysql-5.6.31-linux-glibc2.5-x86_64
mv mysql-5.6.31-linux-glibc2.5-x86_64 /usr/local/mysql
cd /usr/local/mysql/
chown -Rf mysql:mysql /usr/local/mysql
chown -Rf mysql:mysql /home/data
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/home/data --defaults-file=/usr/local/mysql/my.cnf

添加配置文件:
[client]
default-character-set =utf8

[mysqld]
server-id=10
log-bin = mysql-bin

#binlog-ignore-db=mysql

basedir = /usr/local/mysql
datadir = /home/data

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
lower_case_table_names = 1
log_bin_trust_function_creators=1
#复制函数相关、主从多要开启
character-set-server=utf8
max_connections=500

#慢查询日志
long_query_time=2
slow-query-log=On
slow_query_log_file="mysql_slow_query.log"
#将所有没有使用带索引的查询语句全部写到慢查询日志中,设置关闭,需要时再调用 set global log_queries_not_using_indexes=On 打开
log_queries_not_using_indexes=Off

#内存占用优化
innodb_buffer_pool_size = 500M
innodb_buffer_pool_instances = 1
tmp_table_size=20M
max_heap_table_size=20M

改权限:
chown mysql.mysql my.cnf
cp ./support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld start
chkconfig mysqld on

更改root密码:
/usr/local/mysql/bin/mysqladmin -u root password ‘123456‘
#/usr/local/mysql/bin/mysqladmin -u root -h linux2 password ‘new-password‘


执行安全检查脚本:
/usr/local/mysql/bin/mysql_secure_installation


进入mysql创建slave用户:
GRANT replication slave ON *.* TO ‘slave‘@‘%‘ IDENTIFIED BY ‘123456@‘;


mysql5.6 通用二进制安装

标签:

原文地址:http://www.cnblogs.com/fanxuanhui/p/5894495.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!