CentOs6.5系统下MySQL-5.7.19安装

时间:2022-08-31 11:43:45

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

在这里今天给大家推荐一个博文地址: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                            = 3306socket                          = /tmp/mysql3306.sockdefault_character_set           = utf8[mysqld]lower_case_table_names      = 1port                            = 3306basedir                         = /usr/local/mysqldatadir                         = /home/mysql3306/mysql3306socket                          = /tmp/mysql3306.sockpid_file                        = /home/mysql3306/mysql.pidtmpdir                          = /tmp/skip_name_resolve               = 1character_set_server            = utf8collation_server                = utf8_unicode_cimax_connections                 = 512max_connect_errors              = 100000interactive_timeout             = 600wait_timeout                    = 600table_open_cache                = 2048query_cache_type                = 0#query_cache_size               = 64M#query_cache_limit              = 2Mthread_cache_size               = 51max_allowed_packet              = 16Mtmp_table_size                  = 256Mmax_tmp_tables                  = 128max_heap_table_size             = 96Msort_buffer_size                = 4Mread_buffer_size                = 4M #顺序IOjoin_buffer_size                = 4Mread_rnd_buffer_size            = 8M #随机IObulk_insert_buffer_size         = 64M #default_storage_engine               = InnoDBlog_bin                              = /home/mysql3306/logs/mysql-binexpire_logs_days                     = 7binlog_format                        = rowlog_slave_updates                     = 1log_error                            = /home/mysql3306/logs/mysql-error.logslow_query_log                       = 1slow_query_log_file                  = /home/mysql3306/logs/mysql-slow.loglong_query_time                      = 1log_output                           = FILElog_queries_not_using_indexes        = 1     max_binlog_cache_size                = 8Mmax_binlog_size                      = 1024Mbinlog_cache_size                    = 4Msync_binlog                          = 1server_id                            = 15133306          #innodbinnodb_data_home_dir                 = /home/mysql3306/mysql3306/innodb_data_file_path                = ibdata1:512M:autoextendinnodb_log_group_home_dir            = /home/mysql3306/mysql3306innodb_buffer_pool_instances         = 1innodb_buffer_pool_size              = 500Minnodb_buffer_pool_dump_pct          = 40innodb_page_cleaners                 = 4innodb_log_file_size                 = 256Minnodb_log_files_in_group            = 2innodb_log_buffer_size               = 32M  #default 16Minnodb_flush_log_at_trx_commit       = 1innodb_lock_wait_timeout             = 30innodb_undo_directory                = /home/mysql3306/mysql3306/innodb_undo_logs                     = 128  #must >=35.default 128innodb_undo_tablespaces              = 3    #must >=2innodb_undo_log_truncate             = 1innodb_max_undo_log_size             = 1000Minnodb_purge_rseg_truncate_frequency = 128innodb_print_all_deadlocks          = 1    innodb_buffer_pool_load_at_startup  = 1innodb_buffer_pool_dump_at_shutdown = 1innodb_open_files                   = 65536innodb_file_per_table               = 1innodb_lock_wait_timeout            = 30innodb_read_io_threads              = 8innodb_write_io_threads             = 8innodb_io_capacity                  = 200innodb_flush_log_at_trx_commit      = 1innodb_flush_method                 = O_DIRECTinnodb_purge_threads                = 4innodb_support_xa                   = 1innodb_max_dirty_pages_pct          = 75transaction_isolation               = REPEATABLE-READ#repslave-parallel-type=LOGICAL_CLOCKslave-parallel-workers=16master_info_repository=TABLErelay_log_info_repository=TABLErelay_log_recovery=ON[mysqldump]max_allowed_packet              = 16M[mysql]default_character_set           = utf8

创建mysql用户

useradd mysql

创建mysql相关数据目录

mkdir -p /home/mysql3306/msyql3306mkdit -p /home/mysql3306/logs

给mysql相关目录进行授权

chown -R mysql:mysql /home/mysql3306chown -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/profileexport 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';


本文出自 “12224534” 博客,请务必保留此出处http://12234534.blog.51cto.com/12224534/1963575