标签:mysql安装
作者:吴炳锡 来源:http://wubx.net/ 联系方式: wubingxi#163.com 转载请注明作/译者和出处,并且不能用于商业用途,违者必究.
下载二进制版本
http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz
cd /data
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz
2. 下载mysql解压到/opt/mysql下
cd /opt/
mkdir mysql
cd mysql
tar zxvf /data/mysql-5.6.24-linux-glibc2.5-x86_64.tar.gz
3. 创建一个软连
cd /usr/local/
ln -s /opt/mysql/mysql-5.6.24-linux-glibc2.5-x86_64 mysql
4. 创建用户
groupadd mysql
useradd -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
5. 基于我们的配置文件定的环境,创建基本的目录
mkdir /data/mysql
mkdir /data/mysql/mysql3306
cd /data/mysql/mysql3306/
mkdir data
mkdir logs
mkdir tmp
chown -R mysql:mysql /data/mysql/mysql3306
创建/etc/my.cnf配置文件
(配置文件不让上传提示非法类型,附到文章后面)也可以加入QQ群:484942122 获取。
或是参考我另一篇 MySQL 5.6配置参考。
6. 做MySQL初始化
cd /usr/local/mysql
./scripts/mysql_install_db
7. 创建一个启动脚本
cp support-files/mysql.server /etc/init.d/mysql
8. 启动和关闭
/etc/init.d/mysql start |stop|restart
开始我们的MySQL学习之路。
备注:
该操作只适合MySQL 5.6及以下的版本。
配置文件参考:
#my.cnf [client] port = 3306 socket = /tmp/mysql.sock [mysql] prompt="\\u@\\h:\p \\R:\\m:\\s [\\d]>" #tee=/data/mysql/mysql3306/data/query.log no-auto-rehash [mysqld] #misc user = mysql basedir = /usr/local/mysql datadir = /data/mysql/mysql3306/data port = 3306 socket = /tmp/mysql.sock event_scheduler = 0 #tmp tmpdir=/data/mysql/mysql3306/tmp #timeout interactive_timeout = 300 wait_timeout = 300 #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 = slow.log log-error = error.log log_warnings = 2 pid-file = mysql.pid long_query_time = 1 #log-slow-admin-statements = 1 #log-queries-not-using-indexes = 1 log-slow-slave-statements = 1 #binlog binlog_format = row server-id = 1003306 log-bin = /data/mysql/mysql3306/logs/mysql-bin binlog_cache_size = 4M max_binlog_size = 1G max_binlog_cache_size = 2G sync_binlog = 0 expire_logs_days = 10 #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 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 = 10G myisam_repair_threads = 1 #innodb innodb_buffer_pool_size = 100M innodb_buffer_pool_instances = 1 innodb_data_file_path = ibdata1:1G:autoextend innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 64M innodb_log_file_size = 500M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 50 innodb_file_per_table = 1 innodb_rollback_on_timeout innodb_status_file = 1 innodb_io_capacity = 2000 transaction_isolation = READ-COMMITTED innodb_flush_method = O_DIRECT [mysqld_safe] #malloc-lib=/usr/local/mysql/lib/jmalloc.so nice=-19 open-files-limit=65535
本文出自 “吴炳锡-MySQL-DBA-Life” 博客,转载请与作者联系!
标签:mysql安装
原文地址:http://3wnet.blog.51cto.com/10980086/1721614