各位用户为了找寻关于Win10下mysql 8.0.20 安装配置方法图文教程的资料费劲了很多周折。这里教程网为您整理了关于Win10下mysql 8.0.20 安装配置方法图文教程的相关资料,仅供查阅,以下为您介绍关于Win10下mysql 8.0.20 安装配置方法图文教程的详细内容
win10系统下mysql 8.0.20安装和配置超详细教程
mysql下载
mysql直接去官网下载就行,选择community版本(免费)下载,链接。
在select operating system中选择microsoft windows,下方对应出现最新版本的mysql,目前是mysql 8.0.20,有两个zip文件,选择第一个windows (x86, 64-bit), zip archive点击右侧的download按钮进行下载
官网下载有时速度比较慢,直接点击链接也可以下载:
安装与配置
将下载好的压缩包解压缩到全英文目录下,比如我在d盘新建了mysql文件夹,解压到该文件夹下,d:/mysql
然后把mysql 8.0.20所在的路径d:mysqlmysql-8.0.20-winx64添加到环境变量path中
接下来正式安装和配置mysql:
(一)首先在d:mysqlmysql-8.0.20-winx64路径下创建一个my.ini文件,直接新建文本文档,然后重命名为my.ini即可。
在文档中添加以下内容: (注意修改basedir和datadir的路径)
? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=d:mysqlmysql-8.0.20-winx64 # 此处为mysql的解压缩路径
# 设置mysql数据库的数据的存放目录
datadir=d:mysqlmysql-8.0.20-winx64data # 此处同上,先不要在路径中创建data目录,后面初始化时会自动生成
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为utf8
character
-
set
-server=utf8
# 创建新表时将使用的默认存储引擎
default
-storage-engine=innodb
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default
-
character
-
set
=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default
-
character
-
set
=utf8
(二)以管理员权限打开cmd(注意要以管理员权限打开),并将路径切换到d:mysqlmysql-8.0.20-winx64bin
? 1 2 3 4 5 6 7 8 9 10 11 12microsoft windows [version 10.0.18363.815]
(c) 2019 microsoft corporation。保留所有权利。
c:windowssystem32>d:
d:>cd mysql
d:mysql>cd mysql-8.0.20-winx64
d:mysqlmysql-8.0.20-winx64>cd bin
d:mysqlmysql-8.0.20-winx64bin>
输入mysqld --initialize --console,进行初始化。该步可以得到mysql的初始密码,root@localhost后面那一串就是初始密码,先记录下来,待会要用到
? 1 2 3 4 5 6 7d:mysqlmysql-8.0.20-winx64bin>mysqld
--initialize --console
2020-05-10t11:26:21.895908z 0 [system] [my-013169] [server] d:mysqlmysql-8.0.20-winx64binmysqld.exe (mysqld 8.0.20) initializing
of
server
in
progress
as
process 9764
2020-05-10t11:26:21.897278z 0 [warning] [my-013242] [server]
--character-set-server: 'utf8' is currently an alias for the character set utf8mb3, but will be an alias for utf8mb4 in a future release.
please consider using utf8mb4
in
order
to
be unambiguous.
2020-05-10t11:26:21.915225z 1 [system] [my-013576] [innodb] innodb initialization has started.
2020-05-10t11:26:22.619057z 1 [system] [my-013577] [innodb] innodb initialization has ended.
2020-05-10t11:26:24.265774z 6 [note] [my-010454] [server] a
temporary
password
is
generated
for
root@localhost: 9zh31zk-@mof
输入mysqld --install(如果需要安装多个mysql服务,这步输入mysqld --install [服务名])
? 1 2d:mysqlmysql-8.0.20-winx64bin>mysqld
--install
service successfully installed.
显示service successfully installed则说明安装成功 输入net start mysql,启动mysql服务
? 1 2 3d:mysqlmysql-8.0.20-winx64bin>net start mysql
the mysql service
is
starting.
the mysql service was started successfully.
输入mysql -u root -p,使用初始密码登录mysql,在enter password后输入初始密码
? 1 2 3 4 5 6 7 8 9 10 11 12 13d:mysqlmysql-8.0.20-winx64bin>mysql -u root -p
enter
password
: ************
welcome
to
the mysql monitor. commands
end
with
;
or
g.
your mysql
connection
id
is
8
server version: 8.0.20
copyright (c) 2000, 2020, oracle
and
/
or
its affiliates.
all
rights reserved.
oracle
is
a registered trademark
of
oracle corporation
and
/
or
its
affiliates. other names may be trademarks
of
their respective
owners.
type
'help;'
or
'h'
for
help. type
'c'
to
clear the
current
input statement.
登录后,把初始密码修改掉,可以设置成自己容易记住的密码。 输入alter user 'root'@'localhost' identified with mysql_native_password by '自己定义的密码'; (分号一定要带)
? 1 2mysql>
alter
user
'root'
@
'localhost'
identified
with
mysql_native_password
by
'自己定义的密码;
query ok, 0
rows
affected (0.02 sec)
到这一步就完成了 输入show database; ,可以查看包含哪些数据表
? 1 2 3 4 5 6 7 8 9 10mysql> show databases;
+
--------------------+
|
database
|
+
--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+
--------------------+
4
rows
in
set
(0.01 sec)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
原文链接:https://blog.csdn.net/LB_AUTO/article/details/106041858