How to install and start MySQL_MySQL in windows

Source: Internet
Author: User
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.

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.