频道栏目
首页 > 数据库 > MySQL > 正文
mysql5.6bin包安装手记
2016-12-06 09:31:00         来源:Lixora's DB Home  
收藏   我要投稿

---检查依赖包

rpm -qa libaio

---检查mysql是否预安装

rpm -qa msyql

自定义mysql安装目录:

比如 /monitor/,将安装包上传到该目录下;

##root 用户

groupadd mysql

useradd -r -g mysql mysql

mkdir /monitor/

cd /monitor/

tar zxvf mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.6.31-linux-glibc2.5-x86_64 mysql

chown -R mysql:mysql ./mysql

mv /etc/my.cnf /etc/my.cnf.bak

touch /etc/my.cnf

cat > /etc/my.cnf << eof

[client]

socket = /tmp/mysql.sock

default-character-set=utf8

[mysqld]

innodb_buffer_pool_size = 300M

basedir = /monitor/mysql/

datadir = /monitor/mysql/data

port = 3306

back_log = 100

socket = /tmp/mysql.sock

# 默认innodb存储引擎, 默认utf8字符集

default-storage-engine = INNODB

#>=5.5

character-set-server=utf8

# for 5.1 default-character-set=utf8

language = /12c/mysql/mysql/share/english

eof

####################################################

#####优化配置参数,需要根据服务器配置进行调整

####################################################

cat > /etc/my.cnf << eof

[client]

socket = /tmp/mysql.sock

default-character-set=utf8

[mysqld]

innodb_buffer_pool_size = 300M

basedir = /monitor/mysql

datadir = /monitor/mysql/data

port = 3306

back_log = 100

socket = /tmp/mysql.sock

# 默认innodb存储引擎, 默认utf8字符集

default-storage-engine = INNODB

character-set-server=utf8

language = /12c/mysql/mysql/share/english

# 文件系统中小写表名,避免兼容性问题

lower_case_table_names=1

# 不解析dns,忽略外部锁

skip-name-resolve

skip-external-locking

# table and thread cache

table_open_cache = 512

table_definition_cache = 128

thread_cache_size = 128

#事务隔离级别

transaction-isolation = READ-COMMITTED

max_heap_table_size = 32M

# max_length_for_sort_data 避免再次回表获得数据,使用优化过的排序算法

max_length_for_sort_data = 16k

#最大连接数

max_connections=2000

# 加大该次数,以免is blocked的报错

max_connect_errors = 1000000

max_allowed_packet = 2000M

################################ per thread memory ################################

thread_stack = 512k

net_buffer_length = 8K

sort_buffer_size = 2M

join_buffer_size = 4M

read_buffer_size = 2M

read_rnd_buffer_size = 512k

# 最大内存临时表大小

tmp_table_size = 32M

binlog_cache_size = 2M

################################ innodb parameter ################################

# innodb 独立表空间

innodb_file_per_table

# Uncomment the following if you are using InnoDB tables

innodb_data_home_dir=/home/akira/data/mysqldata3306

innodb_data_file_path=ibdata1:2000M;ibdata2:10M:autoextend

innodb_log_group_home_dir=/home/akira/data/mysqldata3306

# Set .._log_file_size to 25 % of buffer pool size

innodb_log_file_size = 100M

innodb_log_buffer_size = 8M

# You can set .._buffer_pool_size up to 50 - 80 %

# of RAM but beware of setting memory usage too high

innodb_buffer_pool_size = 2048M

#innodb_additional_mem_pool_size = 20M

#保障innodb tx log #innodb_flush_log_at_trx_commit = 1

# 我们这里丢失一些数据没有关系

innodb_flush_log_at_trx_commit = 2

innodb_lock_wait_timeout = 50

# 在innodb lru list 先呆一秒再放到lru头

innodb_old_blocks_time=1000

# 取消二阶段事务

innodb_support_xa = OFF

# O_DIRECT 刷新

innodb_flush_method=O_DIRECT

innodb_rollback_on_timeout = 1

innodb_io_capacity = 400

innodb_change_buffering=inserts

innodb_use_native_aio = 1

innodb_strict_mode = 1

innodb_purge_threads=1

innodb_read_io_threads = 8

innodb_write_io_threads = 8

eof

########################################################################################################

####################################################

---初始化数据库

/monitor/mysql/scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --force

---启动mysql 数据库

/monitor/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/monitor/mysql/mysql.pid --user=mysql&

# Next command is optional

# 开机自启动mysql服务报告

cp support-files/mysql.server /etc/init.d/mysql.server

cp /etc/init.d/mysql.server /etc/init.d/mysqld56

chkconfig --add mysqld56

chkconfig --level 2345 mysqld56 on

service mysqld56 start

*******************************

***problem solvetion

*******************************

Mysql 5.6 Can't find messagefile '/usr/share/mysql/errmsg.sys'解决方法

(1)将源码包里面的sql/share/english/errmsg.sys复制到/usr/share/mysql/errmsg.sys

(2) my.cnf 添加 language = /12c/mysql/mysql/share/english

点击复制链接 与好友分享!回本站首页
上一篇:mysql查询最后几条和生成一条包含多条记录的插入语句
下一篇:MySQL数据库(一)
相关文章
图文推荐
文章
推荐
点击排行

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站