Installing mysql-5.6.37 on CentOS 6.9

Source: Internet
Author: User

Installing mysql-5.6.37 on CentOS 6.9

1. Prepare the file system for data storage

Create a new logical volume and mount it to a specific directory. The process is no longer given here.

This assumes that the mounted directory of its logical volume is/data, and then needs to create the/data/mysqldata directory as the storage directory for MySQL data.

[Email protected]/]# mkdir-p/data/mysqldata

2. The new user runs the process in a secure manner:

[Email protected] ~]# useradd mysql-s/sbin/nologin-m

[Email protected] ~]# chown-r mysql:mysql/data/mysqldata

3. Installation and initialization of MySQL

[Email protected] ~]# wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz

[Email protected] ~]# TAR-XF mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz-c/usr/local/src/

[Email protected] ~]# cd/usr/local/

[email protected] local]# Ln-sv/usr/local/src/mysql-5.6.37-linux-glibc2.12-x86_64/mysql #根据实际情况修改

[[Email protected] local]# CD MySQL

[Email protected] mysql]# chown-r mysql:mysql.

4. Provide the main configuration file for MySQL: #默认初始化后会在/etc has my.cnf, if you have content to delete the overlay can

The following configuration files are from the network: Source Address:https://mp.weixin.qq.com/s?__biz=MjM5MjIxNDA4NA==&mid=207854835&idx=1&sn= C998031ae68162faaf7bdfce406ddbac&scene=23&srcid=1013qhyalco3jgtmqm0phaxv#rd

[email protected] mysql]# Yum install libaio* libnuma*-y #安装依赖

[Email protected] mysql]# VIM/ETC/MY.CNF

-----------------------------------------------------------------------------------------------------------

[Client]

#user =mysql #根据实际情况设置用户名

#password =123456

[Mysqld]

####### #basic settings########

Server-id = 11

Port = 3306

user = MySQL

#bind_address = 10.166.224.32 #根据实际情况修改

#autocommit = 0 #5.6.X installation, you need to comment out, after the installation is complete and then open

Character_set_server=utf8mb4

Skip_name_resolve = 1

Max_connections = 800

max_connect_errors = 1000

DataDir =/data/mysqldata #根据实际情况修改, separation and storage of recommendations and procedures

Transaction_isolation = read-committed

Explicit_defaults_for_timestamp = 1

Join_buffer_size = 134217728

Tmp_table_size = 67108864

Tmpdir =/tmp

Max_allowed_packet = 16777216

Sql_mode = "Strict_trans_tables,no_engine_substitution,no_zero_date,no_zero_in_date,error_for_division_by_zero, No_auto_create_user "

interactive_timeout = 1800

wait_timeout = 1800

Read_buffer_size = 16777216

Read_rnd_buffer_size = 33554432

Sort_buffer_size = 33554432

####### #log settings########

Log_error = Error.log

Slow_query_log = 1

Slow_query_log_file = Slow.log

Log_queries_not_using_indexes = 1

Log_slow_admin_statements = 1

Log_slow_slave_statements = 1

Log_throttle_queries_not_using_indexes = 10

Expire_logs_days = 90

Long_query_time = 2

Min_examined_row_limit = 100

####### #replication settings########

Master_info_repository = TABLE

Relay_log_info_repository = TABLE

Log_bin = Bin.log

Sync_binlog = 1

Gtid_mode = On

Enforce_gtid_consistency = 1

Log_slave_updates

Binlog_format = row

Relay_log = Relay.log

Relay_log_recovery = 1

Binlog_gtid_simple_recovery = 1

Slave_skip_errors = Ddl_exist_errors

####### #innodb settings########

Innodb_page_size = 8192

Innodb_buffer_pool_size = 6G #根据实际情况修改, the experimental environment needs to change the size or will be error

Innodb_buffer_pool_instances = 8

Innodb_buffer_pool_load_at_startup = 1

Innodb_buffer_pool_dump_at_shutdown = 1

innodb_lru_scan_depth = 2000

Innodb_lock_wait_timeout = 5

innodb_io_capacity = 4000

Innodb_io_capacity_max = 8000

Innodb_flush_method = O_direct

Innodb_file_format = Barracuda

Innodb_file_format_max = Barracuda

Innodb_log_group_home_dir =/data/mysqldata #根据实际情况修改

Innodb_undo_directory =/data/mysqldata #根据实际情况修改

Innodb_undo_logs = 128

Innodb_undo_tablespaces = 3

Innodb_flush_neighbors = 1

Innodb_log_file_size = 4G #根据实际情况修改, the experimental environment needs to be changed to small

Innodb_log_buffer_size = 16777216

Innodb_purge_threads = 4

Innodb_large_prefix = 1

Innodb_thread_concurrency = 64

Innodb_print_all_deadlocks = 1

Innodb_strict_mode = 1

Innodb_sort_buffer_size = 67108864

####### #semi Sync Replication settings########

Plugin_dir=/usr/local/mysql/lib/plugin #根据实际情况修改

Plugin_load = "Rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"

loose_rpl_semi_sync_master_enabled = 1

loose_rpl_semi_sync_slave_enabled = 1

Loose_rpl_semi_sync_master_timeout = 5000

[mysqld-5.7]

innodb_buffer_pool_dump_pct = 40

Innodb_page_cleaners = 4

Innodb_undo_log_truncate = 1

Innodb_max_undo_log_size = 2G

innodb_purge_rseg_truncate_frequency = 128

Binlog_gtid_simple_recovery=1

Log_timestamps=system

Transaction_write_set_extraction=murmur32

Show_compatibility_56=on

--------------------------------------------------------------------------------------------------------------- --------------------------------------------

[Email protected] mysql]# scripts/mysql_install_db--user=mysql--datadir=/data/mysqldata/

[Email protected] mysql]# chown-r root.

5. Provide SYSV service script for MySQL:

[Email protected] mysql]# Cd/usr/local/mysql

[email protected] mysql]# CP support-files/mysql.server/etc/rc.d/init.d/mysqld

[Email protected] mysql]# Ldconfig

6, modify the PATH environment variable, so that the system can directly use MySQL related commands.

[Email protected] mysql]# echo "path= $PATH:/usr/local/mysql/bin" >/etc/profile.d/mysql.sh
[Email protected] mysql]# source/etc/profile.d/mysql.sh

7. Finally start the service add boot

[[Email protected] mysql]# service mysqld start

[Email protected] mysql]# chkconfig mysqld on

[Email protected] bin]#/mysqladmin-u root password ' 123456 '

[Email protected] bin]# mysql-uroot-p123456

Installing mysql-5.6.37 on CentOS 6.9

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.