Centos6安装mysql5.7.18

今天安装一下二进制包的mysql5.7版本,绿色版用起来清爽!

先根据系统版本下载相应的二进制包.
版本可能随时过期可以进入http://mirrors.sohu.com/mysql/MySQL-5.7/选择相应最新的包!

[root@i2 mysql]# uname -a
Linux f1.cc 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

解压放到相应的目录下面

tar -xzf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql

建立数据文件夹并初化

useradd -s /sbin/nologin mysql
mkdir /data0/mysql
cd /data0
chown mysql:mysql mysql
cd /data0/mysql
mkdir data3360
/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/data0/mysql/data3360/

按照下面的模版建立配置文件,[As of MySQL 5.7.18, my-default.ini is no longer included in or installed by distribution packages.]


# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
 
[mysqld]
 
 
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 
# 一般配置选项
basedir         = /usr/local/mysql
datadir         = /data0/mysql/data3360
port            = 3360
socket          = /data0/mysql/3360.sock
log-error       = /data0/mysql/3360.err
pid-file        = /data0/mysql/3360.pid
 
back_log = 300
max_connections = 3000
max_connect_errors = 50
table_open_cache = 4096
max_allowed_packet = 32M
#binlog_cache_size = 4M
 
max_heap_table_size = 128M
read_rnd_buffer_size = 16M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
query_cache_size = 128M
query_cache_limit = 4M
ft_min_word_len = 8
 
thread_stack = 512K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 128M
#log-bin=mysql-bin
long_query_time = 6
 
 
server_id=1
 
innodb_buffer_pool_size = 1G
innodb_thread_concurrency = 16
innodb_log_buffer_size = 16M
 
 
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
 
[mysqldump]
quick
 
max_allowed_packet = 32M
 
[mysql]
no-auto-rehash
default-character-set=utf8
safe-updates
 
[myisamchk]
key_buffer = 16M
sort_buffer_size = 16M
read_buffer = 8M
write_buffer = 8M
 
[mysqlhotcopy]
interactive-timeout
 
[mysqld_safe]
open-files-limit = 8192
 
[client]
/bin/bash: Q: command not found

添加以下几行

复制启动关闭脚本,修改下mysql=>mysql3360

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql3360
basedir=/usr/local/mysql
datadir=/data0/mysql/data3360
configfile=/data0/mysql/my3360.cnf
mysqld_pid_file_path=/data0/mysql/3360.pid
lockdir='/data0/mysql'
lock_file_path="$lockdir/3360.lock"

添加命令软件链接

ln -s /usr/local/mysql/bin/mysql /usr/bin/
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/

遇到问题:
mysql启动失败,执行下面的命令。

yum install redhat-lsb-core
rm /etc/my.cnf

over~

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code