1. 环境准备
1、上传MySQL二进制压缩包到Linux上
2、解压到/usr/local/mysql中
tar -xzvf mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz -C /usr/local/mysql
查看/usr/local/mysql
3、创建新用户
4、/var/local/mysql 更改属主为mysql
5、mysql/bin 添加到环境变量
6、创建mysql数据目录并更改属主为mysql
2. 二进制方式安装MySQL
1、修改my.cnf到/etc/mysql中
2、初始化3306数据库 指定文件/etc/mysql/my3306.cnf
3、查看/data1/db3306 目录
4、查看error.log文件
5、启动mysql3306实例
6、查看端口
3. 测试
1、进入mysql
2、设置root用户的密码为123456
3、使用密码登录mysql
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