惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
H
Heimdal Security Blog
K
Kaspersky official blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Schneier on Security
G
GRAHAM CLULEY
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
C
Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 司徒正美
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
P
Proofpoint News Feed
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
S
Security Affairs
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
N
News | PayPal Newsroom
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU

Sunshine

SpringBoot定时任务@Scheduled注解详解 | Sunshine 大端模式、小端模式解析 | Sunshine 机器数、原码、反码、补码解析 | Sunshine Spring事件驱动模型实践 | Sunshine IDEA好用的几款插件 | Sunshine Linux使用yum安装MySQL详细步骤(CentOS7.3) | Sunshine Java使用JDBC连接SQLServer数据库(二) | Sunshine Java使用JDBC连接SQLServer数据库(一) | Sunshine Git基本操作整理 | Sunshine Oracle序列创建和使用 | Sunshine Git批量清理本地分支 | Sunshine Statement.RETURN_GENERATED_KEYS获取自增id踩坑记录 | Sunshine GitPages+Hexo搭建个人博客 | Sunshine
Windows下MySQL解压版安装配置详细步骤 | Sunshine
DongyangHu · 2019-11-29 · via Sunshine

安装数据库

一、下载MySQL数据库解压版并解压

从官网下载MySQL压缩包,解压到本地目录

二、配置环境变量

在系统变量path后面添加MySQL安装路径下的bin目录,例:E:\mysql\bin

三、修改MySQL配置文件

在MySQL安装目录下有一个my-default.ini文件,复制一份,改名为my.ini,修改里面的配置。

原始文件my-default.ini:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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]

# 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 = .....



# 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

修改基础配置

  • basedir:MySQL安装根路径
  • datadir:MySQL安装根目录下的data文件夹路径
  • port:默认端口

例:
修改后文件my.ini:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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.

[mysql]
default-character-set=utf8

[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 = E:\mysql
datadir = E:\mysql\data
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

四、添加MySQL服务

    1.以管理员身份打开命令提示符,进入到MySQL安装路径bin目录。执行命令:mysqld -install将mysql安装到windows的服务。如需移除,执行mysqld --remove移除服务。
    2.输入命令:mysqld --initialize ,这一步用于初始化data目录,官方的压缩包解压后并没有data文件夹,运行命令后,自动在根目录下生成data文件夹。

服务启动和维护

一、启动MySQL服务

在命令提示符执行 net start mysql启动MySQL服务;执行net stop mysql停止服务。

二、登录维护MySQL

MySQL默认用户名为root,密码为空。初次安装完成后可以直接进入安装路径的bin目录,执行mysql -u root -p,此时会提示输入密码,直接回车跳过,登录成功。如需设置密码,执行mysqladmin -uroot -p password <新密码>命令,会提示输入旧密码,旧密码为空,直接回车跳过。

  • 新版本的MySQL中,root用户的密码不能为空,在使用前必须设置密码
    • 在配置文件my.ini中,[mysqld]后一行加入skip-grant-tables
    • 重启MySQL服务
    • 执行mysql -u root -p,此时会提示输入密码,直接回车跳过,登录成功
    • 选择mysql数据库。执行use mysql;
    • 对user表执行更新操作。update user set authentication_string=password("你的密码") where user="root"; 
    • 刷新MySQL的系统权限相关表。执行flush privileges 。刷新后退出,执行quit,mysql 新设置用户或更改密码后需刷新相关表,否则会出现拒绝访问
    • 重新启动MySQL服务

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Sunshine