mysql5.6二进制安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql5.6二进制安装相关的知识,希望对你有一定的参考价值。
mysql服务器安装在linux居多,网上有很多种方法,本人推荐用用二进制。理由如下:
1,二进制安装安装方便。
2,oralce制定的在二进制包优化方面也是很优秀的,而大多数dba对GCC编译了解也不是很深,编译源码并不一定会比二进制好。
3,二进制有一定的对比性方便排查问题,源码添加的模块不同不好参考。
=================二进制安装mysql
系统:CentOS 6 x86_64 下载MySQL mkdir /soft cd /soft && wget 解压MySQL tar xf mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz -C /opt 软链接到/usr/local ln -s /opt/mysql-5.6.29-linux-glibc2.5-x86_64 /usr/local/mysql 创建mysql用户 groupadd mysql && useradd -g mysql -M -s /sbin/nologin mysql 创建必要目录(参考my.cnf) mkdir -p /log/mysql/{bin_log,relay_log} && chown mysql.mysql -R /log/mysql/ mkdir -p /data/mysql/{tmp,data3306} && chown mysql.mysql -R /data/mysql 修改环境变量 echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile && . /etc/profile 编辑my.cnf配置文件虚拟机配置 vi /etc/my.cnf [client] port = 3306 socket = /log/mysql/mysql.sock # The MySQL server [mysqld] # Basic port = 3306 user = mysql basedir = /usr/local/mysql datadir = /data/mysql/data3306 tmpdir = /data/mysql/data3306/tmp socket = /data/mysql/data3306/log/mysql.sock pid-file = /log/mysql/mysql.pid log-bin = /log/mysql/mysql-bin log-error = /log/mysql/error.log slow-query-log-file = /data/mysql/mysql3306/log/slow.log skip-external-locking skip-name-resolve log-slave-updates server-id =53376 character-set-server = utf8 slow-query-log binlog_format = row max_binlog_size = 128M binlog_cache_size = 1M expire-logs-days = 5 back_log = 500 long_query_time=1 max_connections=1100 max_user_connections=1000 max_connect_errors=1000 wait_timeout=100 interactive_timeout=100 connect_timeout = 20 slave-net-timeout=30 max-relay-log-size = 256M relay-log = relay-bin transaction_isolation = READ-COMMITTED performance_schema=0 #myisam_recover key_buffer_size = 64M max_allowed_packet = 16M #table_cache = 3096 table_open_cache = 6144 table_definition_cache = 4096 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 query_cache_type=0 query_cache_size = 0 bulk_insert_buffer_size = 32M thread_cache_size = 64 #thread_concurrency = 32 thread_stack = 192K skip-slave-start # InnoDB innodb_data_home_dir = /data/mysql/data3306 innodb_data_file_path = ibdata1:100M:autoextend innodb_buffer_pool_size = 100M innodb_buffer_pool_instances = 8 #innodb_additional_mem_pool_size = 16M innodb_log_file_size = 200M innodb_log_buffer_size = 16M innodb_log_files_in_group = 3 innodb_flush_log_at_trx_commit = 0 innodb_lock_wait_timeout = 10 innodb_sync_spin_loops = 40 innodb_max_dirty_pages_pct = 90 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_file_per_table 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 [mysqldump] quick max_allowed_packet = 128M #myisam_max_sort_file_size = 10G [mysql] no-auto-rehash max_allowed_packet = 128M prompt = ‘(product)\[email protected]\h [\d]> ‘ default_character_set = utf8 [myisamchk] key_buffer_size = 64M sort_buffer_size = 512k read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout [mysqld_safe] #malloc-lib= /usr/local/mysql/lib/mysql/libjemalloc.so #============================================= 初始化 cd /usr/local/mysql && ./scripts/mysql_install_db 路径要这么写,此处看到两个OK表示初始化成功 配置启动脚本 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 启动 /etc/init.d/mysqld start 安全加固 /usr/local/mysql/bin/mysqladmin -u root password ‘e10adc3949ba59abbe56e057f20f883e‘ /usr/local/mysql/bin/mysql -uroot -p‘e10adc3949ba59abbe56e057f20f883e‘ -e "delete from mysql.user where password=‘‘;" /usr/local/mysql/bin/mysql -uroot -p‘e10adc3949ba59abbe56e057f20f883e‘ -e "flush privileges;" mysql> truncate table mysql.db; mysql> drop database test; mysql> flush privileges; 总结:目录规划也很重要,本人是将日志和数据文件完全分开的。
本文出自 “11767337” 博客,请务必保留此出处http://11777337.blog.51cto.com/11767337/1792599
以上是关于mysql5.6二进制安装的主要内容,如果未能解决你的问题,请参考以下文章