快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

CentOs6.5系统下MySQL-5.7.19安装

好长时间没有更新了,今天给大家分享一波简单的文档,菜鸟的入门精神就是不断的学习,不断地找大神帮助!!!!

网站建设哪家好,找创新互联!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了多伦免费建站欢迎大家使用!

在这里今天给大家推荐一个博文地址:http://suMongoDB.blog.51cto.com/

好了!废话少说,干活走起来!!!!!!!!

CentOs6.5下MySQL5.7.19二进制安装是我自己编译的官方源码包

首先我们把一些依赖包安装上:

yum -y groupinstall "Development tools"
yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make

解压mysql二进制安装包:

tar -zxvf mysql-5.7.19.tar.gz -C /usr/local/mysql

编辑my3306.cnf

vim /etc/my3306.cnf

[client]
port                            = 3306
socket                          = /tmp/mysql3306.sock
default_character_set           = utf8
[mysqld]
lower_case_table_names      = 1
port                            = 3306
basedir                         = /usr/local/mysql
datadir                         = /home/mysql3306/mysql3306
socket                          = /tmp/mysql3306.sock
pid_file                        = /home/mysql3306/mysql.pid
tmpdir                          = /tmp/
skip_name_resolve               = 1
character_set_server            = utf8
collation_server                = utf8_unicode_ci
max_connections                 = 512
max_connect_errors              = 100000
interactive_timeout             = 600
wait_timeout                    = 600
table_open_cache                = 2048
query_cache_type                = 0
#query_cache_size               = 64M
#query_cache_limit              = 2M
thread_cache_size               = 51
max_allowed_packet              = 16M
tmp_table_size                  = 256M
max_tmp_tables                  = 128
max_heap_table_size             = 96M
sort_buffer_size                = 4M
read_buffer_size                = 4M #顺序IO
join_buffer_size                = 4M
read_rnd_buffer_size            = 8M #随机IO
bulk_insert_buffer_size         = 64M #
default_storage_engine               = InnoDB
log_bin                              = /home/mysql3306/logs/mysql-bin
expire_logs_days                     = 7
binlog_format                        = row
log_slave_updates                     = 1
log_error                            = /home/mysql3306/logs/mysql-error.log
slow_query_log                       = 1
slow_query_log_file                  = /home/mysql3306/logs/mysql-slow.log
long_query_time                      = 1
log_output                           = FILE
log_queries_not_using_indexes        = 1
     
max_binlog_cache_size                = 8M
max_binlog_size                      = 1024M
binlog_cache_size                    = 4M
sync_binlog                          = 1
server_id                            = 15133306
     
     
#innodb
innodb_data_home_dir                 = /home/mysql3306/mysql3306/
innodb_data_file_path                = ibdata1:512M:autoextend
innodb_log_group_home_dir            = /home/mysql3306/mysql3306
innodb_buffer_pool_instances         = 1
innodb_buffer_pool_size              = 500M
innodb_buffer_pool_dump_pct          = 40
innodb_page_cleaners                 = 4
innodb_log_file_size                 = 256M
innodb_log_files_in_group            = 2
innodb_log_buffer_size               = 32M  #default 16M
innodb_flush_log_at_trx_commit       = 1
innodb_lock_wait_timeout             = 30
innodb_undo_directory                = /home/mysql3306/mysql3306/
innodb_undo_logs                     = 128  #must >=35.default 128
innodb_undo_tablespaces              = 3    #must >=2
innodb_undo_log_truncate             = 1
innodb_max_undo_log_size             = 1000M
innodb_purge_rseg_truncate_frequency = 128
innodb_print_all_deadlocks          = 1    
innodb_buffer_pool_load_at_startup  = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_open_files                   = 65536
innodb_file_per_table               = 1
innodb_lock_wait_timeout            = 30
innodb_read_io_threads              = 8
innodb_write_io_threads             = 8
innodb_io_capacity                  = 200
innodb_flush_log_at_trx_commit      = 1
innodb_flush_method                 = O_DIRECT
innodb_purge_threads                = 4
innodb_support_xa                   = 1
innodb_max_dirty_pages_pct          = 75
transaction_isolation               = REPEATABLE-READ
#rep
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=16
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
[mysqldump]
max_allowed_packet              = 16M
[mysql]
default_character_set           = utf8

创建mysql用户

useradd mysql

创建mysql相关数据目录

mkdir -p /home/mysql3306/msyql3306
mkdit -p /home/mysql3306/logs

给mysql相关目录进行授权

chown -R mysql:mysql /home/mysql3306
chown -R mysql:mysql /usr/local/mysql

初始化mysql

/usr/local/mysql/bin/mysqld --defaults-file=/etc/my3306.cnf --initialize-insecure --explicit_defaults_for_timestamp --basedir=/usr/local/mysql --datadir=/home/mysql3306/mysql3306/ --user=mysql

启动mysql

/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3306.cnf --datadir=/home/mysql3306/mysql3306/ --user=mysql &

配置环境变量

vim /etc/profile

export PATH=$PATH:/usr/local/mysql/bin

进入mysql

mysql -S /tmp/mysql3306.sock

修改mysql用户密码

mysql>UPDATE user SET authentication_string=password('root123') WHERE User='root' AND Host='localhost';

文章标题:CentOs6.5系统下MySQL-5.7.19安装
当前URL:http://6mz.cn/article/gcdcsg.html

其他资讯