温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

windows中Mysql 5.7如何绿色安装

发布时间:2021-11-01 15:55:31 来源:亿速云 阅读:156 作者:小新 栏目:MySQL数据库

这篇文章主要介绍了windows中Mysql 5.7如何绿色安装,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

1.1    下载

http://dev.mysql.com/downloads/mysql/    下载地址,在下拉框中选择相应的版本

1.2    安装

下载下来的绿色安装包,直接解压为E:\mysql

1.3    编辑my.ini文件,

将mydefault.ini copy一份出来,就该其中的参数.

在mysqld中加入如下内容

      basedir="E:\mysql\"

      datadir="E:\mysql\data"

      port=3306

#skip-grant-tables

E:\mysql\bin>mysqld --initialize

2016-09-06T13:57:01.349392Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is

 deprecated. Please use --explicit_defaults_for_timestamp server option (see doc

umentation for more details).

2016-09-06T13:57:01.353393Z 0 [ERROR] --initialize specified but the data direct

ory has files in it. Aborting.

2016-09-06T13:57:01.354393Z 0 [ERROR] Aborting

出现了如上错误,是由于之前在 data文件夹中有文件导致的,删掉data下所有的文件,重新执行mysqld.exe –initialize命令ok

E:\mysql\bin>mysqld.exe --initialize

E:\mysql\bin>mysqld.exe --install

Service successfully installed.

E:\mysql\bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

E:\mysql\bin>mysql -h localhost -u root -p

Enter password: ****

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y

ES)

1.4修改密码

没办法修改密码吧

在mysqld下加入

skip-grant-tables

E:\mysql\bin>net stop mysql

MySQL 服务正在停止.

MySQL 服务已成功停止。

E:\mysql\bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

E:\mysql\bin>mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.14 MySQL Community Server (GPL)

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

mysql> update user set password=password("mysql") where user="root";

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

出现这个错误是由于mysql 5.7后password栏位变成authentication_string

mysql> update user set authentication_string=password("mysql") where user="root"

;

Query OK, 1 row affected, 1 warning (0.10 sec)

Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> quit

Bye

将my.ini中的skip-grant-tables注释掉,重启mysql服务

E:\mysql\bin>mysql -h localhost -u root -p

Enter password: *****

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.14

Copyright (c) 2000, 2016, 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> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo

re executing this statement.

mysql> alter user 'root'@'localhost' identified by 'mysql';

Query OK, 0 rows affected (0.00 sec)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)

感谢你能够认真阅读完这篇文章,希望小编分享的“windows中Mysql 5.7如何绿色安装”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI