Installing MySQL on Microsoft Windows Using a noinstall Zip Archive,

Source: Internet
Author: User

Installing MySQL on Microsoft Windows Using a noinstall Zip Archive,

 The MySQL database is installed on Windows 7 in the past two days. The installation uses the noinstall Zip archiveinstallation package mysql-5.7.18-win32.zip of version 5.7.18. Since version 5.7 has changed from version 5.6 to version, many online installation tutorials have failed. Therefore, a series of problems have been encountered during the installation process, based on the official documents you have viewed and the actual solution process, I have sorted out the installation steps for MySql of a later version, hoping to help you. The detailed steps are as follows:

1. Download the installation package

Slave:

One advantage of using the noinstall Zip Archive installation package is that the installation process is relatively simple, and you do not need to perform visual Installation Steps step by step as the msi installation package does.

Note: From version 5.7.7, the installation package does not contain the data directory. the data directory must be initialized before it can be generated (mysql official text: As of 5.7.7, Windows installation operations installed med usingNoinstallPackage do not include a data directory .). In addition, the. ini configuration file is no longer included in the distribution package from version 5.7.18.

2. initialize the data directory

To initialize the data directory, you can call mysqld --initializeOrmysqld-initialize-insecureThe difference between the two is:mysqld --initializeA random password is generated, which exists in

mysqlIn the error log filemysqld-initialize-insecureWill beroot'@'localhostCreate an empty password. You do not need to enter the password when connecting to the database.

Officially recommendedmysqld-initialize-insecureTo prevent you from forgetting the password when connecting to the database. InitializationdataThe directory process is as follows:

2.1 run cmd.exe with the administrator ID

 Mysqld --initialize

Go to D: \ software \ mysql \ mysql-5.7.18-win32 \ bin,

Mysqld --initializeInitialize and generate the data directory, so will generate a random password, write the Error Log File: D: \ software \ mysql \ mysql-5.7.18-win3 \ data directory *. the file named by err in the format of A temporary password is generated for root @ localhost: 2 RHHs? ElM3h *.

3. Install mysql
D: \ software \ mymysql \ mysql-5.7.18-win32 \ bin> mysqld-install
Success is displayed. Note: If you install denial, you need to open your cmd as an administrator.

4. Start the service

D: \ software \ mysql \ mysql-5.7.18-win32 \ bin> net start mysql

To stop the service, run the net stop mysql command.

5. Modify Environment Variables

Add the D: \ software \ mysql \ mysql-5.7.18-win32 \ bin path to the system environment variables, the reason for this is to directly connect to and run the mysql command in the cmd login path, instead of re-entering the first cd D: \ software \ mysql \ mysql-5.7.18-win32 \ bin every time, then you can execute the mysql command. To set environment variables in windows, follow these steps:

5.1 create an environment variable MYSQL_HOME

Computer-right-click Properties-advanced system settings-advanced-environment variables-system variables-New:

Create an environment variable named MYSQL_HOME with a value of D: \ software \ mysql \ mysql-5.7.18-win32.

6. Connect to the database

After completing the mysqlinstallation and setting the environment variable, you can run cmd.exe and run the connection command.

1) if you initialize the data DIRECTORY through -- initialize, you need to enter a random password during connection.

  • Shell>mysql -u root -p

    Enter password:(enter the random root password here)

If you forget the random password, you can find the random password in the *. err error log file. If your *. err is accidentally deleted, refer to section 8th to change the password.

2) if you are using--initialize-insecureThe password is not applicable to the initialized data directory.

  • Shell>mysql -u root --skip-password

7. connection test

When the connection is successful, run the status command to check the database configuration.

8. Change the password

Method 1: (Use Case: set a new password after successful connection)
Mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Method 2: (Use Case: I forgot my password and couldn't find it)
1. After the service is started, C: \ windows \ System32> mysql-u root-p
The system prompts "Access denied for user 'root' @ 'localhost' (using password: YES)" to reject logon. Otherwise, log on.
2. Don't panic. Next, net stop mysql (stop Service). The method to skip the permission table check is: C: \ windows \ System32> mysqld-skip-grant-tables.
3. Open a new cmd and enter mysql press enter in the bin directory. the mysql> prompt is displayed. Enter use mysql;
4. Change the password
Update mysql. user set authentication_string = password ('123qaz') where user = 'root' and Host = 'localhost ';
5. Refresh: mysql> flush privileges;
6. log out of the quit system.
7. Reconnect and enter the new password.
So far, the process of installing MySQL on Windows 7 is complete.

Reference:
Https://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.