This article describes how to install and start MySQL in windows. you need to follow the instructions in the following sections to learn how to install and start MySQL in windows, for more information, see the following section.
Step 1: Download the mysql installation package or the green version and put it in your favorite directory.
Step 2: Configure environment variables. MYSQL_HOME: the root directory of mysql; add % MYSQL_HOME %/bin directory in path.
Step 3: register the mysql service with windows. You must open the command line with administrator privileges, then switch to the mysql bin directory, enter the command: mysqld.exe -- install MySql -- defaults-file = "d:/mysql/my-default.ini", [d: /mysql/my-default.ini] to their own mysql installation directory.
Step 4: Start the mysql service. Enter "net start mysql" in the command line, and a prompt will be displayed: the MySql service has been started successfully.
Problem: In the user table of the mysql database, an account with an empty username is called an anonymous account. as a result, the user logs on to the database anonymously even though the user name is root, you can see the '@ 'localhost' in the error message. This will result in no permission to create data tables or other operations.
Solution: After the service is disabled and deregistered, log on and perform the following operations.
1. enter the bin directory of mysql in cmd mode, and enter d:/mysql/bin> mysqld -- defaults-file = "d: /mysql/my-default.ini "-- console -- skip-grant-tables, press enter, this command will be suspended.
2. open another command line and switch it to the 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 1Server version: 5.6.20 MySQL Community Server (GPL)
Mysql>
You have connected to the mysql database. you can enter the mysql command.
3. set the 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: 0mysql> FLUSH PRIVILEGES; mysql> quit
The above content is to share with you how to install and start MySQL in windows.