mysql-8.0.11-winx64.zip安装教程详解

下载zip安装包:

  MySQL8.0 For Windows zip包下载地址:

 二,更改密码和密码认证插件

  在MySQL安装目录的 bin 目录下执行命令:

mysql -u root -p

  这时候会提示输入密码,记住了上面第1.3步安装时的密码,填入即可登录成功,进入MySQL命令模式。

在MySQL8.0.4以前,执行

SET PASSWORD=PASSWORD('[修改的密码]');

就可以更改密码,但是MySQL8.0.4开始,这样默认是不行的。因为之前,MySQL的密码认证插件是“mysql_native_password”,而现在使用的是“caching_sha2_password”。

  因为当前有很多数据库工具和链接包都不支持“caching_sha2_password”,为了方便,我暂时还是改回了“mysql_native_password”认证插件。

修改用户密码,在MySQL中执行命令:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';

修改密码验证插件,同时修改密码。

  如果想默认使用“mysql_native_password”插件认证,可以在配置文件中配置default_authentication_plugin项。

[mysqld]default_authentication_plugin=mysql_native_password

示例:

C:\Program Files\MySQL\bin>mysql -u root -pEnter password: ************Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 8Server version: 8.0.11Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';Query OK, 0 rows affected (0.06 sec)mysql>

参考:https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

  到此,安装部署就完成了。官方说测试速度MySQL8比5快两倍。

  可以用 命令查看一下默认安装的数据库:

show databases;use mysql;show tables;mysql> show databases;+--------------------+| Database      |+--------------------+| information_schema || mysql       || performance_schema || sys        |+--------------------+4 rows in set (0.01 sec)mysql>

看到默认初始化了mysql数据库,其中user表里面存储MySQL用户信息。我们可以看一下默认MySQL用户:

select user,host,authentication_string from mysql.user;mysql> select user,host,authentication_string from mysql.user;+------------------+-----------+-------------------------------------------+| user       | host   | authentication_string           |+------------------+-----------+-------------------------------------------+| mysql.infoschema | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE || mysql.session  | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE || mysql.sys    | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE || root       | localhost | *27C237A977F4F44D3F551F1A673BE14DFD232961 |+------------------+-----------+-------------------------------------------+4 rows in set (0.00 sec)mysql>

管理员root的host是localhost,代表仅限localhost登录访问。如果要允许开放其他ip登录,则需要添加新的host。如果要允许所有ip访问,可以直接修改成“%”

创建用户:

CREATE USER 'xxh'@'%' IDENTIFIED WITH mysql_native_password BY 'xxh123!@#';#(需要注意:mysql8.0加密方式修改了)#检查用户select user, host, plugin, authentication_string from user\G;授权远程数据库#授权所有权限 GRANT ALL PRIVILEGES ON *.* TO 'xxh'@'%';#授权基本的查询修改权限,按需求设置GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *.* TO 'xxh'@'%';

查看用户权限

show grants for 'xxh'@'%';

示例:

mysql> use mysql;Database changedmysql> CREATE USER 'xxh'@'%' IDENTIFIED WITH mysql_native_password BY 'xxh123!@#'; #创建用户(注意:mysql8.0加密方式修改了)Query OK, 0 rows affected (0.07 sec)mysql> 

查看密码加密方式:

mysql> select user, host, plugin, authentication_string from user;+------------------+-----------+-----------------------+-------------------------------------------+| user       | host   | plugin        | authentication_string           |+------------------+-----------+-----------------------+-------------------------------------------+| xxh       | %     | mysql_native_password | *70FD6FB4F675E08FF785A754755B5EBA6DA62851 || mysql.infoschema | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE || mysql.session  | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE || mysql.sys    | localhost | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE || root       | localhost | mysql_native_password | *27C237A977F4F44D3F551F1A673BE14DFD232961 |+------------------+-----------+-----------------------+-------------------------------------------+5 rows in set (0.00 sec)mysql>

  另外,如果需要新增账户,或者本机以外的其他人访问MySQL则还需要设置内置账户的host

总结

以上所述是小编给大家介绍的mysql-8.0.11-winx64.zip安装教程详解,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

共享资源网提供最优质的资源集合。
共享资源网 » mysql-8.0.11-winx64.zip安装教程详解

共享资源网提供最优质的资源集合

充值中心 开启会员