【mysql】mysql8.0安装教程(win10)

1.确认你的所用的系统是否支持安装mysql8.0

//Windows支持系统版本
Microsoft Windows 10	x86_64的 

mysql8.0安装支持的平台查询:https://www.mysql.com/support/supportedplatforms/database.html

2.下载安装包

1)安装器安装(本文非使用安装器进行安装,本文是基于压缩包进行的安装配置):

安装器下载地址:https://dev.mysql.com/downloads/installer/

压缩包下载地址:https://dev.mysql.com/downloads/mysql/

选择下载190M多的那个压缩包就可以了。

3.将要安装的zip包下载并解压到你想要的位置(这个是我的解压位置E:\developsoftware\mysql-8.0.13-winx64),解压完毕后双击打开在 ...\mysql-8.0.13-winx64文件目录下创建my.ini文件,将以下内容拷贝到新创建的my.ini文件中:

[mysql]
#启动服务跳过权限表(8.0不好使了)
#skip-grant-tables
# 设置mysql客户端默认字符集
default-character-set=utf8 
[mysqld]
#设置端口
port = 3306 
# 设置mysql的安装目录(根据自己的情况修改)
basedir=E:\developsoftware\mysql-8.0.13-winx64
# 设置mysql数据库的数据的存放目录(根据自己的情况修改)
datadir=E:\developsoftware\data\mysqldata
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

4.开始安装:记住,如果以前机器上装过mysql在开始安装之前一定要先确认一下上一次的东西都被清理干净了。

方法:https://blog.csdn.net/Myuhua/article/details/84817491

用管理员权限打开cmd窗口,点击开始(小旗子)->Windows系统->命令提示符(右击)->更多->以管理员身份运行。

(1)我们先使用免密登录的方法安装,在cmd窗口键入命令:

C:\windows\system32>e:
//去换到mysql安装包的bin路径下
E:\>cd developsoftware\mysql-8.0.13-winx64\bin
#初始化,生成data文件夹
#>mysqld  --initialize-insecure (想免密登录root时使用这一条命令,我这儿时用的免密)
#>mysqld  --initialize (想随机生成一个root密码时使用这一条命令)

E:\developsoftware\mysql-8.0.13-winx64\bin>mysqld --initialize-insecure

E:\developsoftware\mysql-8.0.13-winx64\bin>mysqld install

Service successfully installed.

E:\developsoftware\mysql-8.0.13-winx64\bin>net start mysql
MySQL 服务正在启动 .....
MySQL 服务已经启动成功。
E:\developsoftware\mysql-8.0.13-winx64\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.13 MySQL Community Server - GPL

Copyright (c) 2000, 2018, 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.

mysql>
#这时候你查user表的时候就能看到下面的表信息,值得一提的是mysql8.0将以前版本的password字段改换成了authentication_string字段 。 
mysql> select user,authentication_string from mysql.user;
+------------------+------------------------------------------------------------------------+
| user             | authentication_string                                                  |
+------------------+------------------------------------------------------------------------+
| mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys        | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root             | 这儿是空的所以才可以免密登陆                                                                       |
+------------------+------------------------------------------------------------------------+

如果不使用密码,MySQL8.0到此就安装完成了。

(2)初始化随机密码安装,在cmd键入命令:

C:\windows\system32>e:

E:\>cd developsoftware\mysql-8.0.13-winx64\bin

E:\developsoftware\mysql-8.0.13-winx64\bin>mysqld --initialize

E:\developsoftware\mysql-8.0.13-winx64\bin>mysqld install
Service successfully installed.

E:\developsoftware\mysql-8.0.13-winx64\bin>net start mysql
MySQL 服务正在启动 .....
MySQL 服务已经启动成功。

#使用mysqld --initialize初始化你会发现你再想无密码登录就没戏了
E:\developsoftware\mysql-8.0.13-winx64\bin>mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
#这时候需要你键入密码登录,自动生成的随机密码还是需要去你的.err文件下去找。
#在文件中搜索“password”定位,然后你就看到了文件中这条语句冒号后就是随机的临时密码
#[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: x:fp/e_sk0/P
E:\developsoftware\mysql-8.0.13-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.13

Copyright (c) 2000, 2018, 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.

mysql>
#你现在再想查询user表下的信息,它会阻止你先让你重置初始密码
mysql> select user,authentication_string from mysql.user;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
#重置密码,重置成啥样你喜欢就好
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.41 sec)
#这下你再查询user表就看到root的密码不是空了
mysql> select user,authentication_string from mysql.user;
+------------------+------------------------------------------------------------------------+
| user             | authentication_string                                                  |
+------------------+------------------------------------------------------------------------+
| mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys        | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root             | $A$005$*at;U.Y`_+9--KHHjtubDCZZ4.fbaliTrwhwz0dqx/OsAFc2l4rdfUBv1       |
+------------------+------------------------------------------------------------------------+
4 rows in set (0.00 sec)
#这时候你退出mysql再用新密码登录试一下就可以了
mysql> quit
Bye
E:\developsoftware\mysql-8.0.13-winx64\bin>mysql -uroot -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.13 MySQL Community Server - GPL

Copyright (c) 2000, 2018, 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.

mysql>

至此,使用安装mysql8.0使用密码就完成了。

目前试过在安全模式下重置mysql8.0的密码还不好使,后期研究出来再更。还有我在使用得过程中发现一件有意思得事,用navicat导出某表得sql后,在导入到另一个库中建表,这时它自己导出来得sql自己都不认了,喀喀喀报错。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小猿架构

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值