MySQL 5.7.37 数据库下载安装教程(Windows 无需安装版)
1.MySQL 下载
不论要安装什么软件,做的第一件事下载软件,MySQL 是免费开源的,直接从官网下载即可,目前最新版本是 8 版本,对于初学者建议 5 版本即可。



我们选择下载历史版本,找到 5.7 版本。

看你的电脑多少位,32 下载 32 位的,64 下载 64 位的,根据需求下载第一个或者第二个。

需要登录,没有账号用邮箱注册一个,注册登录后界面是这样的,如果一开始就算登录状态就会直接下载。

好了,点击下载即可。
2.MySQL 安装
找到下载的压缩包,直接解压至你要安装的位置路径就行。

在解压的根目录创建一个my.ini
的配置文件。




basedir
与datadir
需根据自己解压文件所在的路径,后者需要在前者路径上在加上\data
。将下面的代码更改路径后复制到你的my.ini
配置文件中。
打开命令行,使用管理员身份打开:

切换至解压根目录后的bin
路径,比如我的根路径为:
后面加上bin
路径:

在目标路径命令行输入:mysqld --install
(安装)

如果失败,检查一下路径是否正确,或者试试配一下电脑的环境变量(一般情况不需要配置)。博主没有配置环境变量后续也没出现问题,如果失败了,主要是路径错误,一定要注意是bin
文件的路径。
如果需要配置环境变量,环境变量配置过程如下:




复制解压文件中bin
文件的路径,粘贴即可。

一直点确定就可以了。
然后输入指令:mysqld --initialize
(初始化)继续输入指令:net start mysql
(运行)

输入初始化指令后,根目录下会出现一个data
文件夹。

找到data
文件夹中后缀为err
的文件,并打开。

找到 A temporary password is generated for root@localhost: xxxxxxxx 这一行。root@localhost:
后面的就是初始密码,第一次登陆需要使用这个密码,登陆后一定要更改密码。

输入命令:mysql -u root -p
回车,输入密码登录。

首次使用初始密码登录成功后必须重设密码,否则会一直提示下面这行错误。You must reset your password using ALTER USER statement before executing this statement.
然后使用下面这个指令改密码,MySQL 版本 5.7.6 版本以前用户可以使用如下命令:SET PASSWORD = PASSWORD('这里输入您的新密码');
MySQL 版本 5.7.6 版本开始的用户可以使用如下命令:mysql> ALTER USER USER() IDENTIFIED BY '这里输入您的新密码';


重设完密码,就可以正常使用了。

其他启动指令:
好了,MySQL Community Server 5.7.37 配置教程(无需安装版)到这就结束了。
版权声明: 本文为 InfoQ 作者【未见花闻】的原创文章。
原文链接:【http://xie.infoq.cn/article/ea9b1e4b3d942e813adf901ec】。文章转载请联系作者。
评论