Windows installation mysql-5.7 compressed version detailed tutorial

Article reference: https://blog.csdn.net/wengengeng/article/details/52013650

foreword

Install the mysql database today and enter the mysql official website. For windows, there are two versions of the files available for download, one is the .msi installation file, and the other is the .biz compressed package. I have been using the installation file to install it before, and I have been unsuccessful. Today I suddenly don't want to use the installation file, it's time to install it with a compressed package. So I downloaded the compressed package and searched for some installation tutorials. The installed mysql service always reported an error. I looked for the tutorial again, but the service still could not be started...
So, I don't trust Baidu anymore. Enter the mysql official website and find the documentation of mysql5.7: http://dev.mysql.com/doc/refman/5.7/en/installing.html, step by step, finally succeeded.

download mysql

  • Enter the official website: https://www.mysql.com/

  • Click the [Downloads] tab
  • At the bottom there is a【

    MySQL Community Edition

     (GPL) ], click【Community (GPL) Downloads »
  • Click [DOWNLOAD] under [ MySQL Community Server  (GPL) ]
  • https://dev.mysql.com/downloads/mysql/  Select the version to download
  • Download 【 Windows (x86, 64-bit), ZIP Archiveon the pop-up page

install mysql

The compressed package is equivalent to an installation-free file. To use it, you need to configure it correctly and start the database service through the service.

1. Unzip the compressed package to your favorite location

This example is extracted to: D:\mysql-5.7.13-winx64, under the folder


2. Create a my.ini file with the following contents:
[plain] view plain copy
  1. [mysqld]  
  2. port=3306  
  3. basedir  ="D:\\mysql-5.7.13-winx64\\"  
  4. datadir  ="F:\\mysqlData\\"  
  5.   
  6.   
  7. max_allowed_packet = 32M  
Note that basedir and datadir must be configured, and basedir is the directory you unzipped. The official documentation says that if you like to use backslashes, you should use double backslashes, but not for slashes. That is: D:\\mysql-5.7.13-winx64\\ or: D:/mysql-5.7.13-winx64/
Since I like to separate the data files of the database, I configure the datadir to other places to facilitate management. Also, create the directory.

3. Configure environment variables

  • Add a variable called MYSQL_HOME.
  • Modify the Path variable and add %MYSQL_HOME%\bin at the end.
  •  Note: After setting the environment variables, the runtime library is missing: vcredist_x64.exe is missing msvcp120.dll, so you have to download the runtime library at https://www.microsoft.com/en-us/search/result.aspx?q= Search for Visual Studio 2013 and find

    visual studio 2013 download, and find

    Update for Microsoft Visual Studio 2013 Update 4 (KB3023304), there is a genuine runtime library, just download and install.


4. Install mysql service

  • Run cmd as an administrator and enter the bin directory of mysql.
  • Initialize the database file
[plain] view plain copy
  1. mysqld  --initialize  
After the initialization is successful, some files will be generated in the datadir directory. Among them, the xxx.err file describes the temporary password of the root account. The line looks like this:
[plain] view plain copy
  1. 2016-07-24T05:19:20.152135Z 1 [Note] A temporary password is generated for root@localhost: bL2uuwuf0H(X  

That is, the password is: bL2uuwuf0H(X

  • register mysql service
[html] view plain copy
  1. mysqld -install MySQL  
  • start mysql service
[plain] view plain copy
  1. net start MySQL  

  • Change root password
Type the following command, hit enter, and enter the default password above:
  1. mysql -u root -p  

After entering the MySQL command line mode, enter the following command. The new_password in the command is the new password of the root account. Please modify it.
  1. ALTERUSER'root'@'localhost' IDENTIFIED BY'new_password'   

Guess you like

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