安装mysql5.7-基于二进制方式

01.下载地址 https://downloads.mysql.com/archives/community/ 02.创建目录 mkdir -p /data/sysRoot/ cd /data/sysRoot/ 03.下载解压 wget -c 'https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz' tar -zxvf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz mv mysql-5.7.35-linux-glibc2.12-x86_64 mysql-5.7.35 ln -s /data/sysRoot/mysql-5.7.35 /usr/local/mysql mkdir mysql-5.7.35/{data,log,tmp} - 04.设置环境变量 echo 'export PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile.d/mysql source /etc/profile.d/mysql mysql -V 05.安装mysql依赖包 yum install 1 -y libaio libaio-devel 06.创建mysql普通用户并授权 useradd mysql -s /sbin/nolongin -M chown -R mysql:mysql mysql-5.7.35 07.编辑mysql配置文件 # cat /etc/my.cnf [client] port = 3306 socket = /data/sysRoot/mysql-5.7.35/data/mysql-3306.sock default-character-set = utf8mb4 [mysql] prompt="\\u:\\R:\\m:\\s@[\d]> " no-auto-rehash [mysqld] symbolic-links #mysql基本信息 user = mysql port = 3306 basedir = /data/sysRoot/mysql-5.7.35/ datadir = /data/sysRoot/mysql-5.7.35/data socket = /data/sysRoot/mysql-5.7.35/data/mysql-3306.sock pid-file = mysql-3306.pid server_id = 330601 character-set-server = utf8mb4 sql_mode ="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER" transaction_isolation = READ-COMMITTED secure_file_priv=/data/sysRoot/mysql-5.7.35/tmp explicit_defaults_for_timestamp=0 lower_case_table_names =1 #连接限制参数 skip_name_resolve = 1 open_files_limit = 65535 back_log = 1024 max_connections = 2000 max_connect_errors = 1000000 interactive_timeout = 7200 wait_timeout = 7200 #max_user_connections = 256 #锁参数 lock_wait_timeout = 3600 #表缓存参数 table_open_cache = 4096 table_definition_cache = 4096 table_open_cache_instances = 64 #临时表参数 tmp_table_size = 64M max_heap_table_size = 64M internal_tmp_disk_storage_engine = InnoDB #线程参数 thread_stack = 512K thread_cache_size = 768 #缓存参数 sort_buffer_size = 16M join_buffer_size = 32M max_allowed_packet = 32M query_cache_size = 0 query_cache_type = 0 read_buffer_size = 8M read_rnd_buffer_size = 16M #binlog参数 sync_binlog = 1 binlog_format = row max_binlog_size = 512M binlog_row_image = full expire_logs_days = 7 log_bin = /data/sysRoot/mysql-5.7.35/data/mysql-bin log_bin_index =/data/sysRoot/mysql-5.7.35/data/mysql-bin.index binlog_cache_size = 4M max_binlog_cache_size = 2G #日志参数 log_timestamps = SYSTEM slow_query_log = 1 long_query_time = 1.0 log_queries_not_using_indexes =1 log_throttle_queries_not_using_indexes = 60 min_examined_row_limit = 100 slow_query_log_file = /data/sysRoot/mysql-5.7.35/data/slow.log log_slow_admin_statements = ON log_warnings =2 log-error = /data/sysRoot/mysql-5.7.35/data/error.log #MyISAM参数 external-locking = FALSE key_buffer_size = 32M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 16M myisam_max_sort_file_size = 1G myisam_repair_threads = 1 #INNODB参数 #1)线程设置 innodb_thread_concurrency = 0 innodb_sync_spin_loops = 100 innodb_spin_wait_delay = 30 #2)缓存设置 innodb_buffer_pool_size = 1024M innodb_buffer_pool_instances = 4 innodb_buffer_pool_load_at_startup = ON innodb_buffer_pool_dump_at_shutdown = ON #3)表空间设置 innodb_data_file_path = ibdata1:512M:autoextend innodb_undo_logs = 128 innodb_max_undo_log_size = 2G innodb_undo_tablespaces = 8 innodb_undo_log_truncate = 1 innodb_undo_directory = undolog #4)redo log设置 innodb_log_buffer_size = 32M innodb_log_file_size = 512M innodb_log_files_in_group = 3 innodb_flush_log_at_trx_commit = 1 #5)IO设置 # 根据您的服务器IOPS能力适当调整 # 一般配普通SSD盘的话,可以调整到 10000 - 20000 # 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000 innodb_io_capacity = 8000 innodb_io_capacity_max = 15000 innodb_flush_neighbors = 0 innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_purge_threads = 1 innodb_page_cleaners = 1 innodb_open_files = 65535 innodb_file_per_table = 1 innodb_max_dirty_pages_pct = 85 innodb_flush_method = O_DIRECT innodb_lru_scan_depth = 4000 innodb_checksum_algorithm = crc32 innodb_lock_wait_timeout = 10 innodb_rollback_on_timeout = ON innodb_print_all_deadlocks = ON innodb_online_alter_log_max_size = 4G innodb_stats_on_metadata = 0 innodb_checksums = ON #6)performance_schema performance_schema = ON performance_schema_instrument = '%=on' #7)innodb monitor innodb_monitor_enable="module_innodb" innodb_monitor_enable="module_server" innodb_monitor_enable="module_dml" innodb_monitor_enable="module_ddl" innodb_monitor_enable="module_trx" innodb_monitor_enable="module_os" innodb_monitor_enable="module_purge" innodb_monitor_enable="module_log" innodb_monitor_enable="module_lock" innodb_monitor_enable="module_buffer" innodb_monitor_enable="module_index" innodb_monitor_enable="module_ibuf_system" innodb_monitor_enable="module_buffer_page" innodb_monitor_enable="module_adaptive_hash" [mysqldump] quick max_allowed_packet = 32M 08.初始化数据库 /data/sysRoot/mysql-5.7.35/bin/mysqld --defaults-file=/etc/my.cnf --initialize --basedir=/data/sysRoot/mysql-5.7.35 --datadir=/data/sysRoot/mysql-5.7.35/data --user=mysql 09.准备启动脚本 后台启动 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chkconfig --add mysqld systemctl start mysqld 前台启动 mysqld_safe --defaults-file=/etc/my.cnf 10.配置root密码 查看旧密码 cat /data/sysRoot/mysql-5.7.28/data/error.log |grep password 设置密码 mysqladmin password -S /data/sysRoot/mysql-5.7.35/data/mysql-3306.sock 11.登陆测试 mysql -uroot -p -h

锦绣源码库是一家优秀的网站源码学习交流平台,为广大源码爱好者提供优质的小程序源码、APP源码、H5源码、商城源码教程以及公众号模块教程,大部分是会员免费,网站长期受到各站长的收藏及浏览。
用户必须遵守《计算机软件保护条例(2013修订)》第十七条:为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。鉴于此条例,用户从本平台下载的全部源码(软件)教程仅限学习研究,未经版权归属者授权不得商用,若因商用引起的版权纠纷,一切责任均由使用者自行承担,本平台所属公司及其雇员不承担任何法律责任。
锦绣源码库 » 安装mysql5.7-基于二进制方式
赞助VIP 享更多特权,立即登录下载海量资源
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡