频道栏目
首页 > 数据库 > 其他综合 > 正文
MySQL单实例安装
2016-08-27 09:25:45           
收藏   我要投稿

1. 环境准备

1、上传MySQL二进制压缩包到Linux
image

2、解压到/usr/local/mysql中

 tar -xzvf mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz -C /usr/local/mysql

查看/usr/local/mysql
iamge

3、创建新用户
image

4、/var/local/mysql 更改属主为mysql
image

5、mysql/bin 添加到环境变量

image

6、创建mysql数据目录并更改属主为mysql

image

2. 二进制方式安装MySQL

1、修改my.cnf到/etc/mysql中

image

2、初始化3306数据库 指定文件/etc/mysql/my3306.cnf

image

3、查看/data1/db3306 目录

image

4、查看error.log文件<喎"/kf/ware/vc/" target="_blank" class="keylink">vcD4NCjxwPjxpbWcgYWx0PQ=="image" src="/uploadfile/Collfiles/20160827/20160827093051176.png" title="\" />

5、启动mysql3306实例

image

6、查看端口

image

3. 测试

1、进入mysql

image

2、设置root用户的密码为123456

image

3、使用密码登录mysql

image

4. 附件 mysql3306.cnf

[mysqld]
# GENERAL #
user = mysql
port = 3306
socket = /data1/db3306/my3306.sock
pid_file = /data1/db3306/mysql.pid
datadir = /data1/db3306/
tmpdir = /data1/tmp
log_bin = /data1/db3306/3306-mysql-bin
relay-log = /data1/db3306/3306-relay-bin
log_error = /data1/db3306/error.log
slow_query_log_file = /data1/db3306/slow-queries.log
long_query_time=1
sync_binlog = 0
expire_logs_days = 7
back_log=1024
skip-name-resolve
skip-slave-start
skip-external-locking
skip-character-set-client-handshake
explicit_defaults_for_timestamp=true
default_storage_engine = InnoDB
bind-address=0.0.0.0
#lower_case_table_names  = 0
myisam_recover = FORCE,BACKUP
transaction-isolation = READ-COMMITTED
table_definition_cache = 4096
table_open_cache = 4096

# connection #
max_connections = 1100
max_user_connections = 1000
max_connect_errors = 1000

# timeout #
wait_timeout = 100
interactive_timeout = 100
lock_wait_timeout = 3
connect_timeout = 20
slave-net-timeout = 30

# character # 
character-set-server=utf8
init-connect='SET NAMES utf8'

# disabled query cache #
query_cache_type = 0
query_cache_size = 0

# replication #
server_id=71493306
gtid_mode=ON
enforce-gtid-consistency
log-slave-updates
binlog-format=row
slave-parallel-workers=6
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync_master_info = 10000
slave_sql_verify_checksum=1
skip-slave-start

# session #
key_buffer_size = 128M
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 32M
bulk_insert_buffer_size = 32M
sort_buffer_size = 128K
read_buffer_size = 1M
read_rnd_buffer_size = 1M
join_buffer_size = 128K
myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K

# INNODB #
innodb_flush_method = O_DIRECT
innodb_data_home_dir = /data1/db3306/
innodb_data_file_path = ibdata1:10M:autoextend
#redo log
innodb_log_group_home_dir=/data1/db3306/
innodb_log_files_in_group = 3
innodb_log_file_size = 1G
#innodb performance
innodb_flush_log_at_trx_commit = 0
innodb_file_per_table = 1
innodb_buffer_pool_instances = 8
innodb_io_capacity = 2000
innodb_lock_wait_timeout = 30
binlog_error_action = ABORT_SERVER
innodb_buffer_pool_size = 256M
innodb_max_dirty_pages_pct=90
innodb_file_format=Barracuda 
innodb_support_xa = 0
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1
点击复制链接 与好友分享!回本站首页
相关TAG标签 实例
上一篇:ORACLE数据库基本操作
下一篇:MySQL数据类型
相关文章
图文推荐
点击排行

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

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