Reprint (install MySQL under Windows)

Source: Internet
Author: User

Reprint please declare source: http://blog.csdn.net/u013067166/article/details/49951577

Recently reinstalled the system, to MySQL official website downloaded the latest MySQL5.7.9, I chose the decompression version, after the installation started service, the prompt service can not start, in the Internet to find a lot of tutorials, got a long time did not fix, then decided to go to the English official website to find the answer, finally found this on the official website:

As of MySQL 5.7.6, the Zip Archive no longer includes a data directory. To initialize a MySQL installation by creating the data directory and populating the tables in the MySQL system database, Initialize MySQL using either --initialize or --initialize-insecure . For additional information, see section 2.10.1.1, "Initializing the Data Directory manually Using mysqld".

The general meaning is that after the MySQL5.76, the decompression version no longer contains a data directory, the initial installation of MySQL need to use --initialize or--initialize-insecure指令,然后我就尝试了一下。

方法:

1. Uninstall the previously installed MySQL service, 2 (if the command-line window executes net start MySQL appears in Figure 1 hints ignore this step, direct next)


Figure 1

Switch to the bin directory of your MySQL root directory and execute mysqld--remove.


Figure 2

2. Check your My.ini is configured correctly, if you are afraid of mistakes can refer to my, but remember to change the path to your own path. If you have not configured it before, create a new text file in the root directory of the MySQL installation directory, as shown in the following configuration. (My MySQL directory is D:\MySoftWare\mysql-5.7.9-winx64)

[Mysqld]

#basedir代表自己MySQL的安装根目录
Basedir = d:\\mysoftware\\mysql-5.7.9-winx64

#datadir代表自己MySQL的数据库保存的目录, if you do not create a new data folder in the root directory of the MySQL installation
DataDir = D:\\mysoftware\\mysql-5.7.9-winx64\\data

#port代表端口号
Port = 3306
Sql_mode=no_engine_substitution,strict_trans_tables



3. In the DOS window, switch directories to the root of MySQL, then execute bin\mysqld--defaults-file=my.ini--initialize-insecure (preferably copy me, otherwise it is easy to hit the wrong).



4. Perform bin\mysqld--install to install the MySQL service.



5. Try starting the MySQL service again, execute net start MySQL in the Command line window and see if your MySQL service will start successfully! (Enter password there, the initial password is empty, directly enter the line)


6. Finally, it is important to enter after the password must be set, or MySQL back to generate random password, the second time will not go! 5.7.9 There are some changes in the way the password is set, the old version of the password is saved in the password of the MySQL database user table, and 5.7.9 's password field becomes authentication_string, and the direct SQL command changes its value. Then restart the MySQL service!

Execute the following command sequentially (set the password to 123456):

Use MySQL;

Update user set authentication_string= "123456";

Exit

net stop MySQL;

net start MySQL;

Mysql-u root-p

[Enter password]

-------------I was the split line and successfully entered MySQL------------

I hope we can all succeed!!!

Reprint (install MySQL under Windows)

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.