原创

mysql5.7 绿色版运行方法

最近下载了一个mysql5.7,下载之后,发现根目录居然找不到data目录。莫非5.7的版本之后没有示例的数据库了?。。

找到了官方关于绿色免安装的文档:https://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html

各位可以优先参考官方的文档。官方文档有个说明:

As of MySQL 5.7.6, the ZIP archive no longer includes a data directory. To initialize a MySQL >installation by creating the data directory and populating the tables in the mysql system database, initialize MySQL using either --initialize or --initialize-insecure. For additional information, see Section 2.10.1.1, “Initializing the Data Directory Manually Using mysqld”.

5.7.6版本开始,zip的包将不含data目录。也就是要用--initialize手工去初始化一个

执行

xxx> mysqld.exe --initialize

可以发现在安装目录下初始化了一个

执行

xxx> mysqld.exe --install

在服务中添加mysql服务

xxx>net start mysql

即可启动成功

默认的my.ini文件去哪里了呢?,我翻遍了所有的mysql目录,都木有找到,貌似是一个默认的路径。这不重要了。。。

那默认的root密码是啥呢?

因为我们使用mysqld.exe --initialize初始化的数据库,所以mysql默认给我们分配了一个随机密码。可以在

data/你计算机名.err文件中搜索:A temporary password is generated for 找到密码

error

接下来愉快的链接

PS D:\Program\mysql-5.7.20-winx64\bin> .\mysql.exe -u root -p

Enter password: ************

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

Your MySQL connection id is 8

Server version: 5.7.20


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

我已经连上了,然后修改下root密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin';

Query OK, 0 rows affected (0.00 sec)

修改成功,enjoy! sqlyog

本文来自:mysql5.7 绿色版运行方法-小码农,转载请保留本条链接,感谢!

温馨提示:
本文最后更新于 2021年01月26日,已超过 1,186 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录