[root@xd-10-189 songlisha]# cat install_mysql.sh #!/bin/bash mysql_src=/songlisha/home/admin/mysql_data install_scr=/songlisha/usr/local rm -rf $install_scr/mysql rm -rf $mysql_src rm -rf /etc/my.cnf groupadd mysql useradd -g mysql mysql mkdir -p $mysql_src/{binlog,innodb_log,innodb_ts,log,mydata,relaylog,sock,tmpdir} chown -R mysql.mysql $mysql_src tar zxvf $install_scr/mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz -C $install_scr mv $install_scr/mysql-5.6.34-linux-glibc2.5-x86_64 $install_scr/mysql cat >> /etc/my.cnf <<EOF [client] port = 3306 socket = /songlisha/home/admin/mysql_data/sock/mysql3306.sock [mysql] prompt='\u@\h [\d]> ' no-auto-rehash default_character_set = utf8 [mysqld] user = mysql basedir = /songlisha/usr/local/mysql datadir = /songlisha/home/admin/mysql_data port = 3306 socket = /songlisha/home/admin/mysql_data/sock/my3307.sock event_scheduler = 0 max_allowed_packet=64M #skip-grant-tables #timeout interactive_timeout = 300 wait_timeout = 100000 #character set character-set-server = utf8 open_files_limit = 65535 max_connections = 100 max_connect_errors = 100000 skip-name-resolve = 1 #logs log-output=file slow_query_log = 1 slow_query_log_file = /songlisha/home/admin/mysql_data/log/slow.log log-error = /songlisha/home/admin/mysql_data/log/error.log log_warnings = 2 pid-file = mysql.pid #log-slow-admin-statements = 1 #log-queries-not-using-indexes = 1 log-slow-slave-statements = 1 long_query_time = 0.3 #binlog binlog_format = row server-id = 1273307 log-bin = /songlisha/home/admin/mysql_data/binlog/mybin.log binlog_cache_size = 4M max_binlog_size = 1G max_binlog_cache_size = 2G sync_binlog = 0 expire_logs_days = 7 #relay log skip_slave_start = 1 max_relay_log_size = 1G relay_log_purge = 1 relay_log_recovery = 1 log_slave_updates #slave-skip-errors=1032,1053,1062 tmpdir = /songlisha/home/admin/mysql_data/tmpdir explicit_defaults_for_timestamp=1 #buffers & cache table_open_cache = 2048 table_definition_cache = 2048 table_open_cache = 2048 max_heap_table_size = 96M sort_buffer_size = 2M join_buffer_size = 2M thread_cache_size = 256 query_cache_size = 0 query_cache_type = 0 query_cache_limit = 256K query_cache_min_res_unit = 512 thread_stack = 192K tmp_table_size = 96M key_buffer_size = 8M read_buffer_size = 2M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 32M #myisam myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 1G myisam_repair_threads = 1 #innodb innodb_data_home_dir=/songlisha/home/admin/mysql_data/innodb_ts innodb_log_group_home_dir=/songlisha/home/admin/mysql_data/innodb_log innodb_buffer_pool_size = 1G innodb_buffer_pool_instances = 1 innodb_data_file_path = ibdata1:10G:autoextend innodb_flush_log_at_trx_commit = 2 innodb_log_file_size = 500M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 70 innodb_file_per_table = 1 innodb_rollback_on_timeout innodb_status_file = 1 transaction_isolation = READ-COMMITTED innodb_log_buffer_size = 16M innodb_lock_wait_timeout = 10 innodb_sync_spin_loops = 40 innodb_support_xa = 0 innodb_thread_concurrency = 0 innodb_thread_sleep_delay = 500 #innodb_file_io_threads = 4 innodb_concurrency_tickets = 1000 log_bin_trust_function_creators = 1 innodb_flush_method = O_DIRECT innodb_read_io_threads = 16 innodb_write_io_threads = 16 innodb_io_capacity = 2000 innodb_file_format = Barracuda innodb_purge_threads=1 innodb_purge_batch_size = 32 innodb_old_blocks_pct=75 innodb_change_buffering=all innodb_stats_on_metadata=OFF [mysqld_safe] open_file_limit = 65535 EOF $install_scr/mysql/scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --datadir=/songlisha/home/admin/mysql_data --basedir=/songlisha/usr/local/mysql cp $install_scr/mysql/support-files/mysql.server /etc/init.d/mysqld service mysqld start chkconfig mysqld on echo "export PATH="\$PATH:/songlisha/usr/local/mysql/bin"" >> /etc/profile export PATH="/songlisha/usr/local/mysql/bin:$PATH" source /etc/profile exit 0
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。