Andya

#1、 下载并解压
###1.1 下载并解压
![解压包](https://upload-images.jianshu.io/upload_images/4714126-2e8e794c2d95d493.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###1.2 在bin里创建my.ini配置文件
![my.ini配置](https://upload-images.jianshu.io/upload_images/4714126-c159c75d328d6275.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###1.3 创建data文件夹(在执行安装时,保证为空文件夹)
![创建data](https://upload-images.jianshu.io/upload_images/4714126-7304759bce953245.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
#2、 环境配置
###2.1 变量添加
1)添加系统变量
![系统变量](https://upload-images.jianshu.io/upload_images/4714126-7def00a74acac14c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2)添加到path中
![path变量](https://upload-images.jianshu.io/upload_images/4714126-be282ce5d4eca5df.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
#3、 cmd中进行初始化安装
###3.1 初始化
```mysqld --initialize```
![服务初始化](https://upload-images.jianshu.io/upload_images/4714126-07c31f6e603cec0f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###3.2 寻找随机密码
>在data下找到xxx.err文件进入后找到随机密码

![xxx.err文件中的随机密码](https://upload-images.jianshu.io/upload_images/4714126-287c09d1ea615196.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###3.3 注册mysql服务
```mysqld -install MySQL```
![注册服务](https://upload-images.jianshu.io/upload_images/4714126-e19d38548f1f8bca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###3.4 启动mysql服务
```net start mysql```
![启动服务](https://upload-images.jianshu.io/upload_images/4714126-aed406f33f7b909b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
###3.5 进入mysql
```mysql -u root -p```
![进入数据库](https://upload-images.jianshu.io/upload_images/4714126-d847cdaf2ea0797c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
>**注意**:该密码就是上面的初始化文件中的随机密码
###3.6 修改密码
```ALTER USER 'root'@'localhost' IDENIFTIED BY 'new_password';```
>其中,new_password换成自己的新密码即可

相关文章: