mysql-5.7.18-winx64 installation-free version configuration

Step 1: Download

Official website address: https://dev.mysql.com/downloads/mysql/

 

 

Step 2: Unzip

The decompression path can be set by yourself. I choose to put it on the F drive here, and the decompression path is F:\MySQL

 

 

Step 3: Configuration File

Generally, after the MySQL installation version is successfully installed, there will be a my.ini configuration file by default. Because we are free to install here, we need to create a new my.ini configuration file by ourselves.

Create a new my.ini file under the decompression path in the second step (F:\MySQL\mysql-5.7.18-winx64), open it with Notepad, and copy the following content (be sure to replace the place involving the path with your own path), and then save it, the content is as follows:

 

[client]

port=3306

default-character-set=utf8

 

[mysqld]

#Set the installation directory of mysql

basedir=F:\MySQL\mysql-5.7.18-winx64

#Set up the data directory of mysql

datadir=F:\MySQL\mysql-5.7.18-winx64\data

 

character_set_server=utf8

sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER

#Enable query cache

explicit_defaults_for_timestamp=true

skip-grant-tables

 

 

Step 4: Configure environment variables

Computer -> Properties -> Advanced System Settings (Advanced) -> Environment Variables

1) Click the New button under System Variables, enter the variable name and variable value

      Variable name: MYSQL_HOME

      Variable value: F:\MySQL\mysql-5.7.18-winx64

2) Edit the system variable path, add %MYSQL_HOME%\bin; in front or behind (don't forget to add a semicolon), click

      Click OK to .

 

 

Step 5: Install the MySQL service

进入C:\Windows\System32,找到cmd.exe右键选择以管理员身份运行,进入MySQL的bin目录,如下图:


安装服务前先初始化data目录,以前的5.6版本自带data目录,如果没有这一步则无法启动mysql服务

初始化data目录命令:mysqld --initialize或者mysqld --initialize-insecure,两者的区别在于前者会生成随机的数据库密码,后者则为空。


 

初始化data目录有点慢,要等一小会,初始化完成后就可以看到data目录了,如下图所示:


 

接着输入mysqld install安装即可,如果电脑环境正常的话,就会安装成功,如下图所示:


 

安装mysql服务这一步会出现丢失MSVCR120.dll文件或者应用程序无法正常启动(0xc000007b)的问题,

针对这些问题我们给出一些解决方案,请继续往下看。


 

 

 

第六步:mysql install安装不成功的解决方案(只针对win764位的操作系统)

1)下载DirectX修复工具增强版(v3.5)

网盘链接:http://pan.baidu.com/s/1mismNmo    密码:eg5a

此版为绿色版,直接打开检测并修复即可。

DirectX修复工具到底能解决什么问题,请参考原文http://blog.csdn.net/vbcom/article/details/8244068

 

2)一般的*.dll文件通过DirectX修复工具能修复好,如果修复后还报丢失MSVCR120.dll文件,请下载

MSVCR120.dll文件,然后将其放在C:\Windows\System32目录下

网盘链接:http://pan.baidu.com/s/1dFIP1S1     密码:11ie

 

 

第七步:启动mysql服务,输入net start mysql即可,如下图:


 

 

第八步:打开mysql

先进入bin目录,输入命令:mysql -u -root -p,在第五步初始化data目录的时候使用mysqld --initialize命令生成随机密码,所以这边要输入的密码不知道,可以到err文档中进行查看。

步骤为:

1)打开F:\MySQL\mysql-5.7.18-winx64文件夹,搜索栏输入*.err查找log文件,以记事本方式打开,快捷键ctrl+F查找temporary password,划线部分即为随机密码,如下图所示:



 

 

2)输入密码进行登录。如果每次都要到log文件中查看会很麻烦,所以这边可以修改mysql登录密码。

命令行为:alter user 'root'@'localhost' identified by 'password';

password可以修改为你们自己想要设置的密码。



 

3)输入命令行exit;退出后,使用新设置的密码进行登录,登录成功。

 

到这里就告一段落了。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326220731&siteId=291194637