mysql5.6的安装步骤

1.下载mysql

下载地址:https://downloads.mysql.com/archives/community/

在这里我们下载zip的包

2.解压mysql包到指定目录

3. 添加my.ini文件

java 复制代码
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
 
[mysqld]
 
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
 
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
 
# These are commonly set, remove the # and set as required.
# 设置mysql的安装目录
basedir = D:/my_application/mysql-5.6.51-winx64
# 设置mysql数据库的数据的存放目录
datadir = D:/my_application/mysql-5.6.51-winx64/data
# 设置3306端口
port = 3306
# server_id = .....
 
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
 
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 
# 允许最大连接数
max_connections = 200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors = 10
# 服务端使用的字符集默认为UTF8
character-set-server = utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine = INNODB
# 默认使用"mysql_native_password"插件认证
default_authentication_plugin = mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set = utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set = utf8mb4

说明:

client\]代表客户端默认设置内容; \[mysql\]代表我们使用mysql命令登录mysql数据库时的默认设置; \[mysqld\]代表数据库自身的默认设置; ### 4. 设置mysql的环境变量 鼠标右键电脑--\>属性--\>高级系统设置--\>环境变量 1.添加mysql环境变量 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/fdda1da1f4294b23a1c426fe48298d98.png) 2.path里新增mysql环境变量 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/65e99dc9848d437586b260ce97a4c636.png) ### 5. 初始化数据目录 打开命令提示符(以管理员身份运行),并运行初始化命令: ```java mysqld --initialize-insecure --basedir=D:/my_application/mysql-5.6.51-winx64 --datadir=D:/my_application/mysql-5.6.51-winx64/data ``` 执行成功如下图所示: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d34b358e50574330b168896193921043.png) ### 6.安装MySQL服务 ```java mysqld --install MySQL56 --defaults-file=D:/my_application/mysql-5.6.51-winx64/my.ini ``` 说明: MySQL56是服务名称 执行成功如下图所示: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/90419231119848f19c2dc4a33a9277fd.png) ### 7. 启动MySQL服务 ```java net start MySQL56 ``` 执行成功如下图所示: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/da39905935ee4a53a2bd8cf07dc9955e.png) ### 8. 连接到MySQL ```java mysql -u root ``` 执行成功如下图所示: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/f6cc9272df8a41d388767d6abef536b0.png) ### 9. 设置root用户密码并查看 ```java SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456'); SELECT User, Host, Password FROM mysql.user WHERE User = 'root'; ``` 执行成功如下图所示: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/3f2faa52533b4824a6ab5383a8640bb3.png) ### 10. 用客户端连接mysql ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/ff9a5ad053604c2288d421dc619660f7.png) ### 11.参考 https://blog.csdn.net/addtyp/article/details/131831782

相关推荐
源码集结号5 小时前
一套智慧工地云平台源码,支持监管端、项目管理端,Java+Spring Cloud +UniApp +MySql技术开发
java·mysql·spring cloud·uni-app·源码·智慧工地·成品系统
GanGuaGua5 小时前
MySQL:表的约束
数据库·mysql
Li zlun6 小时前
MySQL 性能监控与安全管理完全指南
数据库·mysql·安全
韩立学长9 小时前
【开题答辩实录分享】以《走失人口系统档案的设计与实现》为例进行答辩实录分享
mysql·mybatis·springboot
杨云龙UP10 小时前
小工具大体验:rlwrap加持下的Oracle/MySQL/SQL Server命令行交互
运维·服务器·数据库·sql·mysql·oracle·sqlserver
阿巴~阿巴~10 小时前
使用 C 语言连接 MySQL 客户端(重点)
服务器·数据库·sql·mysql·ubuntu
清水加冰10 小时前
【MySQL】SQL调优-如何分析SQL性能
数据库·sql·mysql
知其然亦知其所以然10 小时前
MySQL性能暴涨100倍?其实只差一个“垂直分区”!
后端·mysql·面试
风跟我说过她10 小时前
CentOS 7 环境下 MySQL 5.7 深度指南:从安装、配置到基础 SQL 操作
sql·mysql·centos
数据知道12 小时前
Go基础:正则表达式 regexp 库详解
开发语言·mysql·golang·正则表达式·go语言