http://www.cnblogs.com/fujinzhou/p/5750442.html
centos6.5下的mysql5.6.30安装
1.解压mysql
tar -xf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz -C /usr/local
mv mysql-5.6.30-linux-glibc2.5-x86_64 mysql-5.6.30
2.添加用户与组
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
chown -R mysql:mysql mysql-5.6.30
3.安装数据库
mkdir /usr/local/mysql-5.6.30/data3306
cd mysql-5.6.21/scripts
./mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.6.30/ --datadir=/usr/local/mysql-5.6.30/data3306/
4.配置文件
cd /usr/local/mysql-5.6.30/support-files
cp my-default.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysql
vim /etc/init.d/mysql
修改文件中的两个变更值
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
max-connections = 800
skip-name-resolve
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1073M
table_open_cache = 512
sort_buffer_size = 512K
read_buffer_size = 512K
read_rnd_buffer_size = 512K
join_buffer_size = 128K
myisam_sort_buffer_size = 64M
thread_cache_size = 256
query_cache_size = 0
query_cache_type = 0
tmp_table_size = 64M
max_heap_table_size = 64M
basedir=/usr/local/mysql-5.6.30/
datadir=/usr/local/mysql-5.6.30/data3306
pid-file = /usr/local/mysql-5.6.30/data3306/mysql.pid
log_error = /var/log/mysqld.log
# set binary logging is required for replication
log-bin=mysql-bin
binlog_cache_size = 32M
# event_scheduler shutoff in mysqld slave
event_scheduler = 1
binlog_format=row
expire_logs_days = 3
# set slow log
slow_query_log = 1
long_query_time = 2
#set 字符
character_set_server = utf8
#set 大小写敏感
lower_case_table_names=1
# set innodb params
innodb_data_home_dir = /usr/local/mysql-5.6.30/data3306
innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql-5.6.30/data3306
innodb_buffer_pool_size = 5972M
innodb_additional_mem_pool_size = 10M
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_lock_wait_timeout = 10
[client]
default-character-set = utf8
5.配置环境变量
vi /etc/profile
export MYSQL_HOME="/usr/local/mysql-5.6.30"
export PATH="$PATH:$MYSQL_HOME/bin"
6.添加自启动服务
chkconfig mysql on
7.启动mysql
service mysql start
8.登录mysql及改密码
mysqladmin -u root password ‘your_password‘ #修改root用户密码
mysql -u root -p #登录mysql,需要输入密码