MySQL 5.7.22 二进制包安装及免安装版Windows配置方法

所属分类: 数据库 / Mysql 阅读数: 1434
收藏 0 赞 0 分享

下面通过代码给大家介绍了mysql 5.7.22 二进制包安装方法,具体代码如下所示:

.目录规划:
程序目录:/usr/local/mysql
数据目录:/data/mysql
PID和SOCKET文件位置:/tmp
.文件下载:
官方默认只提供最新版本的,历史版本的下载地址:
https://downloads.mysql.com/archives/
.7.22版本下载:
# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
文件下载大小约614M。
#tar -xzf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
#mv /usr/local/mysql-5.7.22-linux-glibc2.12-x86_64/ /usr/local/mysql
# echo "export PATH=$PATH:/usr/local/mysql/bin" >/etc/profile.d/mysql.sh
# source /etc/profile.d/mysql.sh
.创建用户和授权:
#useradd mysql
#passwd mysql
#mkdir -p /data/mysql
#chown -R mysql:mysql /data/mysql
#chmod -R 755 /data/mysql
.设置参数:
[mysqld]
#basic
#skip-grant-tables 
#validate_password        =OFF
datadir             = /data/mysql
port              = 3306
pid-file            = /tmp/mysql.pid
socket             = /tmp/mysql.sock
log_error            = error.log
slow-query-log         = 1
slow-query-log-file      = slow.log
long_query_time        = 0.2
log-bin            = mysql_bin.log
binlog_format         = ROW
expire-logs-days        = 1
relay-log           = mysql_relay.log
relay_log_recovery       = 1
general_log          = on
general_log_file        = general.log
lower_case_table_names     = 1
server-id            = 1
character_set_client_handshake = FALSE
character_set_server      = utf8mb4
collation_server        = utf8mb4_unicode_ci
init_connect          ='SET NAMES utf8mb4'
interactive_timeout       = 172800
wait_timeout          = 172800
max_prepared_stmt_count     =1048576 
max_connections         = 8000
#connections
 max_connections=4000
 key_buffer_size=200M
 low_priority_updates=1
 table_open_cache = 8000
 back_log=1500
 query_cache_type=0
 table_open_cache_instances=16
#files
 innodb_file_per_table =on
 innodb_log_file_size=1024M
 innodb_log_files_in_group = 3
 innodb_open_files=4000
#buffers
innodb_buffer_pool_size=1G
innodb_buffer_pool_instances=32
#innodb_additional_mem_pool_size=20M
innodb_log_buffer_size=64M
join_buffer_size=32K
sort_buffer_size=32K
#innodb
innodb_checksums=0
innodb_doublewrite=0
innodb_support_xa=0
innodb_thread_concurrency=0
innodb_flush_log_at_trx_commit=2
innodb_max_dirty_pages_pct=50
innodb_use_native_aio=1
innodb_stats_persistent = 1
#innodb_spin_wait_delay= 6 / 96
#performance
innodb_adaptive_flushing = 1
innodb_flush_neighbors = 0
innodb_read_io_threads = 4
innodb_write_io_threads = 4
innodb_io_capacity = 4000
innodb_purge_threads=1
innodb_adaptive_hash_index=0
#monitor
innodb_monitor_enable = '%'
performance_schema=OFF
[mysql]
user = root
.初始化数据库实例:
/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql --initialize-insecure
.启动:
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
# /etc/init.d/mysql start
Starting MySQL... SUCCESS! 
.验证和设置远程访问:
[root@node1 soft]# mysql -p -S /tmp/mysql.sock
mysql> grant all privileges on *.* to root@'%' identified by 'oracle' with grant option;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

补充:mysql 5.7.22 免安装版Windows配置

下载mysql 5.7.22

解压文件,发现根目录下没有data目录

进入bin 目录:

cd d:\Program Files\MySQL\MySQL Server 5.7\bin  

运行

mysqld --initialize-insecure --user=mysql

执行完命令发现根目录多了个data 的文件夹

配置my.ini 文件,

执行命令:

mysqld install MYSQL57 --defaults-file="G:\DataDBs\mysql-5.7\my.ini"

启动mysql 服务,默认密码为空登录进去

update mysql.user set authentication_string=password('newpwd'),password_expired='N' where user='root';

修改密码并修改过时策略(字段名和mysql 5.6略有不同,5.6的:update user set password = password('newpwd'),password_expired='N' where user = 'root';)

-- 开启远程连接权限
grant all on *.* to root@'%' identified by 'newpwd' with grant option;
flush privileges;

然后重启mysql 服务就配置完成了

以上所述是小编给大家介绍的MySQL 5.7.22 二进制包安装及免安装版Windows配置方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

更多精彩内容其他人还在看

MySQL优化之表结构优化的5大建议(数据类型选择讲的很好)

很多人都将 数据库设计范式 作为数据库表结构设计“圣经”,认为只要按照这个范式需求设计,就能让设计出来的表结构足够优化,既能保证性能优异同时还能满足扩展性要求
收藏 0 赞 0 分享

MySQL的表分区详解

这篇文章主要介绍了MySQL的表分区,例如什么是表分区、为什么要对表进行分区、表分区的4种类型详解等,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL基本命令、常用命令总结

这篇文章主要介绍了MySQL基本命令、常用命令总结,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql 强大的trim() 函数

这篇文章主要介绍了mysql 强大的trim() 函数使用方法,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL函数大全及用法示例分享

这篇文章主要介绍了MySQL的一些函数及用法示例,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL不支持INTERSECT和MINUS及其替代方法

这篇文章主要介绍了MySQL不支持INTERSECT和MINUS情况下的替代方法,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql修改数据库编码(数据库字符集)和表的字符编码的方法

Mysql数据库是一个开源的数据库,应用非常广泛。以下是修改mysql数据库的字符编码的操作过程和将表的字符编码转换成utf-8的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql远程登录出错的解决方法

mysql远程登录出错的情况,先比很多朋友都有遇到过吧,下面有个不错的解决方法,大家可以参考下
收藏 0 赞 0 分享

mysql通过查看跟踪日志跟踪执行的sql语句

在SQL SERVER下跟踪sql采用事件探查器,而在mysql下如何跟踪sql呢,下面有个不错的方法,大家可以参考下
收藏 0 赞 0 分享

MySQL错误代码大全

本章列出了当你用任何主机语言调用MySQL时可能出现的错误。首先列出了服务器错误消息。其次列出了客户端程序消息
收藏 0 赞 0 分享
查看更多