tar-xfMysqL-5.6.30-linux-glibc2.5-x86_64.tar.gz-C/usr/local
mvMysqL-5.6.30-linux-glibc2.5-x86_64MysqL-5.6.30
2.添加用户与组
groupaddMysqL
useradd-gMysqLMysqL-s/sbin/nologin
chown-RMysqL:MysqLMysqL-5.6.30
3.安装数据库
mkdir/usr/local/MysqL-5.6.30/data3306
cdMysqL-5.6.21/scripts
./MysqL_install_db--user=MysqL--basedir=/usr/local/MysqL-5.6.30/--datadir=/usr/local/MysqL-5.6.30/data3306/
cd/usr/local/MysqL-5.6.30/support-files
cpmy-default.cnf/etc/my.cnf
cpMysqL.server/etc/init.d/MysqL
vim/etc/init.d/MysqL
修改文件中的两个变更值
[MysqLd]
port=3306
socket=/var/lib/MysqL/MysqL.sock
max-connections=800
skip-name-resolve
skip-external-locking
key_buffer_size=384M
max_allowed_packet=1073M
table_open_cache=512
sort_buffer_size=512K
read_buffer_size=512K
read_rnd_buffer_size=512K
join_buffer_size=128K
myisam_sort_buffer_size=64M
thread_cache_size=256
query_cache_size=0
query_cache_type=0
tmp_table_size=64M
max_heap_table_size=64M
basedir=/usr/local/MysqL-5.6.30/
datadir=/usr/local/MysqL-5.6.30/data3306
pid-file=/usr/local/MysqL-5.6.30/data3306/MysqL.pid
log_error=/var/log/MysqLd.log
#setbinaryloggingisrequiredforreplication
log-bin=MysqL-bin
binlog_cache_size=32M
#event_schedulershutoffinMysqLdslave
event_scheduler=1
binlog_format=row
expire_logs_days=3
#setslowlog
slow_query_log=1
long_query_time=2
#set字符
character_set_server=utf8
#set大小写敏感
lower_case_table_names=1
#setinnodbparams
innodb_data_home_dir=/usr/local/MysqL-5.6.30/data3306
innodb_data_file_path=ibdata1:2000M;ibdata2:10M:autoextend
innodb_log_group_home_dir=/usr/local/MysqL-5.6.30/data3306
innodb_buffer_pool_size=5972M
innodb_additional_mem_pool_size=10M
innodb_log_file_size=512M
innodb_log_buffer_size=16M
innodb_flush_log_at_trx_commit=2
innodb_flush_method=O_DIRECT
innodb_file_per_table=1
innodb_lock_wait_timeout=10
[client]
default-character-set=utf8
5.配置环境变量
vi/etc/profile
exportMysqL_HOME="/usr/local/MysqL-5.6.30"
exportPATH="$PATH:$MysqL_HOME/bin"
6.添加自启动服务
chkconfigMysqLon
serviceMysqLstart
MysqLadmin-urootpassword'your_password'#修改root用户密码
MysqL-uroot-p#登录MysqL,需要输入密码
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250