MySQL5.6快速安装【转】
下载MySQL5.6
访问MySQL官网
点击Downloads,然后选择Archives
选择MySQL Community Server
选择合适版本和平台
选择下载预先编译好的二进制安装包
将下载好的包转移至linux机器中
# mkdir /opt/mysql/
# cd /opt/mysql/
将下载的安装包放到/opt/mysql/下
解压安装包并创建相关文件夹
# tar zxvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
# cd /usr/local/
# ln -s /opt/mysql/mysql-5.6.23-linux-glibc2.5-x86_64 mysql
# groupadd mysql
# useradd -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
# mkdir /usr/local/mysql/logs
# mv /etc/my.cnf /etc/my.cnf.bak
编辑配置文件
# vim /usr/local/mysql/data/my.cnf
写入以下内容
#my.cnf start
[client]
port = 3306
socket = mysql.sock
[mysql]
#pager="less -i -n -S"
#tee=/home/mysql/query.log
no-auto-rehash
[mysqld_multi]
mysqld = /usr/local/mysql /bin/mysqld_safe
mysqladmin = /usr/local/mysql /bin/mysqladmin
log = /usr/local/mysql/logs/mysqld_multi.log
[mysqld]
#misc
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data/
port = 3306
socket = /tmp/mysql.sock
event_scheduler = 0
#timeout
interactive_timeout = 300
wait_timeout = 300
#character set
character-set-server = utf8
open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
#logs
log-output=file
slow_query_log = 1
slow_query_log_file = /usr/local/mysql/logs/slow.log
log-error = /usr/local/mysql/logs/error.log
log_warnings = 2
pid-file = /usr/local/mysql/logs/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 = mixed
server-id = 10518
log-bin = mybinlog
binlog_cache_size = 4M
max_binlog_size = 1G
max_binlog_cache_size = 2G
sync_binlog = 1
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
#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 = 1G
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:1G:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 64M
innodb_log_file_size = 256M
innodb_log_files_in_group = 2
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
[mysqld3306]
basedir= /usr/local/mysql
datadir = /usr/local/mysql/data/
innodb_buffer_pool_size = 4G
transaction_isolation = REPEATABLE-READ
########my.cnf配置文件结束#######
安装依赖
# yum install libaio
初始化
# /usr/local/mysql/scripts/mysql_install_db
配置启动脚本
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/
设置环境变量
# echo "export PATH=$PATH:/usr/local/mysql/bin">>/etc/profile
# source /etc/profile
更改数据库文件夹属主
# chown -R mysql.mysql /usr/local/mysql/
启动数据库
# /etc/init.d/mysql.server start
把mysql变为系统服务
# chkconfig --add mysql.server
# chkconfig mysql.server on
转自
MySQL5.6快速安装 - 今日头条(www.toutiao.com)
http://www.toutiao.com/i6392545735941816834/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?