mysql安装


下载 MySQL 5.7.34

绿色版下载地址: https://dev.mysql.com/downloads/mysql/5.7.html 

安装版下载地址: https://dev.mysql.com/downloads/windows/installer/5.7.html 

连接中如果不带后面的 版本号.html 就是最新的版本

带版本号和不带版本号区别

绿色版配置

解压目录 放入 C盘

再 MySQL 文件夹中 新建 一个空的文件夹 data,默认是不带这个文件夹的

新建 my.ini 文件 由于官网从5.7.18开始之后都不在二进制包中提供my-default.ini文件,所以这就需要我们自行创建一个my.ini文件(如果有my-default.ini文件,复制一份,把名称修改成my.ini 即可)

在把下面的配置信息复制到my.ini文件中 

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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]
#skip-grant-tables 
# 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.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
basedir ="C:\mysql-5.7.34-winx64"   # 设置mysql的安装目录 
datadir ="C:\mysql-5.7.34-winx64\data"   # 设置mysql数据库的数据的存放目录,必须是data,或者是//xxx/data  
 
 
# 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 
 
#服务端的编码方式
character-set-server=utf8mb4
[client]
#客户端编码方式,最好和服务端保存一致
loose-default-character-set=utf8mb4
 
[WinMySQLadmin]  
Server = "C:\mysql-5.7.34-winx64\bin\mysqld.exe"

配置Mysql的运行环境

配置环境变量 ,增加路径

C:\mysql-5.7.34-winx64\bin

以管理员身份运行命令

mysqld --initialize-insecure --user=mysql

运行之后,mysql文件夹下的data目录中会增加一些内容,原来是空文件夹

配置MySql服务  运行命令,注意,要在bin目录中运行服务安装命令

mysqld -install

如果不是在bin中执行的命令,则服务的可执行文件路径会变成 C:\Program Files 目录中,造成服务无法启动

 

启动服务

输入命令net start mysql,启动Mysql服务

 

修改密码

登录mysql后,修改密码(默认密码为空

 (1)以管理员身份打开“命令行窗口”,输入mysql -uroot -p并按下回车键

 (2)在弹出Enter password: 时,继续按下回车键,即可登录mysql

 (3)输入命令use mysql;

 (4)输入命令ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'; (注意末尾要有分号)

 (5)输入命令flush privileges; 

 (6)输入命令exit;

 

 

配置允许外网连接:

(1)以管理员身份打开“命令行窗口”,输入mysql -uroot -p并按下回车键

 (2)在弹出Enter password: 时,继续按下回车键,即可登录mysql

 (3)输入命令use mysql;

 (4)输入命令 update user set host='%' where user='root' and host='localhost'; ; (注意末尾要有分号) 增加允许远程访问的用户或者允许现有用户的远程访问。

给root授予在任意主机(%)访问任意数据库的所有权限。

 (5)输入命令exit;

 (6)输入命令 net stop mysql 停止服务

 (7)输入命令 net stop mysql 启动服务

 

版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
YES开发框架
上一篇:window远程桌面连接报错:出现身份验证错误。要求的函数不受支持
下一篇:EF 值转换
评论列表

发表评论

评论内容
昵称:
关联文章

mysql安装
docker安装mysql
MySQL 8.0 绿色版安装
GZDBHelper连接MySQL数据库
Nuget安装
mysql服务器端运行环境要求
EF Core使用MySQL
Docker安装JIRA 7.2.2
Python安装
MYSQL数据库连接工具: DBeaver 与 Navicat
linux查询mysql服务位置以及数据库所在目录
npm更新安装包,重新安装
CentOS安装宝塔
CentOS安装nginx
安装华为电脑管家
CentOS安装java
LInux Jenkins安装
02.设备驱动安装
RabbitMQ安装备忘录
python安装pythoncom模块

联系我们
联系电话:15090125178(微信同号)
电子邮箱:garson_zhang@163.com
站长微信二维码
微信二维码