How to install and start MySQL under windows

  • 2020-11-18 06:31:01
  • OfStack

The following four steps describe how to install and start MySQL under windows. See below for details.

Step 1: Download the mysql installation package or the green version and place it in your favorite directory.

Step 2: Configure environment variables. MYSQL_HOME, the root of mysql; Add the %MYSQL_HOME%/bin directory to path.

Step 3: Register with windows for mysql services. You must open the command line with administrator privileges, then switch to bin directory of mysql and enter the command: mysqld.exe --install MySql -- defaults-ES26en ="d:/mysql/ my-ES30en.ini ", [d:/mysql/ my-default.ini] to change to your own mysql installation directory.

Step 4: Start the mysql service. Type net start mysql on the command line. Success will indicate that the MySql service has been started successfully.

Problem: In the user list of mysql database, there is an account named empty, that is, an anonymous account. As a result, although root is used when logging in, it is actually an anonymous login, which can be seen by the "@" localhost" in the error prompt. This results in operations such as creating tables without permission.

Solution: After the service is closed and logged out, the user logs in and performs the following actions.

1. Enter cmd mode into bin directory of mysql and enter d:/mysql/bin > mysqld -- ES63en-ES64en ="d:/mysql/ my-ES68en.ini "--console -- ES71en-ES72en-ES73en, enter, this command line will hang.

2. Open another command line, also cut to mysql bin directory, d:/mysql/bin > mysql-u root mysql, press Enter


Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.20 MySQL Community Server (GPL)

mysql >

You are connected to the mysql database. You are ready to enter the mysql command.

3. Set a password


mysql> update user set password=PASSWORD('123456') where user='root';
Query OK, 2 rows affected (0.02 sec)
Rows matched: 3 Changed: 2 Warnings: 0
mysql> FLUSH PRIVILEGES; 
mysql> quit

The above is how to install and start MySQL under windows. I hope you enjoy it.


Related articles: