Windows 64-bit MySQL 5.7 or later package decompression does not have the data directory and My-default.ini and My.ini files, and the service does not start the solution and the method of modifying the initial password

Source: Internet
Author: User
Tags mysql client

After downloading the decompression MySQL file, there are some problems in the middle, finally resolved, hoping to help the needs of friends.

MySQL official website: https://dev.mysql.com/downloads/mysql/Click to open the link

Take version 8.0.12 For example

First install package decompression, there is no online tutorial mentioned in the Data folder and My-default.ini

To configure the environment variables, please refer to the online tutorial (https://www.cnblogs.com/jqpy1994/p/9553118.html), this is generally no problem, that is, in the environment variables in the path to add the MySQL package bin location, I am:

D:\Develop\mysql\mysql-8.0.12\bin

The main points to note are:

(1)My-default.ini file does not exist unimportant, the key needs to create a new My.ini file in the root directory, the following details:

[MySQL]
# Set the MySQL client default character set
Default-character-set=utf8
[Mysqld]
#设置3306端口
Port = 3306
# set up the MySQL installation directory
Basedir=d:\\softnew\\mysql\\mysql-5.7.20-winx64
# Maximum number of connections allowed
max_connections=200
# The character set used by the service side defaults to the 8-bit encoded latin1 character set
Character-set-server=utf8
# The default storage engine that will be used when creating a new table
Default-storage-engine=innodb

You can directly copy and paste, mainly modify the next Basedir after the path, Note that the path is \ \ Rather than \

(2) Please do not create the Data folder yourself

Many tutorials on the web suggest that you create a new empty Data folder and add an additional sentence to the My.ini file:

# Set up a storage directory for MySQL database data
Datadir=d:\\develop\\mysql\\mysql-8.0.12\\bin\\data

But after doing the problem occurs, this will cause the service can not start, do not add this sentence, do not create a new data folder, MySQL automatically generated data is good, how to solve it:

1) Open the CMD Command Window as an administrator (win+r input cmd, right-click on cmd and select Run as Administrator), and go to the bin directory of the MySQL installation directory (CD). Then enter the command mysqld install to display the success

2) Re-enter: mysqld--initialize There should be no hint at this time

3) Re-enter: net start MySQL display

The MySQL service is starting:

The MySQL service has started successfully.

The contents of the last Data folder should appear as:

Another note: The first time you log in to MySQL, you will be prompted to enter the initial password, which is considered security factors, command: mysqld--initialize will randomly generate the password.

The initial password in the Xxx.err file under the Data folder can be opened with Notepad to find

A temporary password is generated for [email protected] (can be found with ctrl+f )

where [email protected] is followed by a string is the initial password

Enter the password after entering can be modified with the following command, here the password to root (of course, you can change to whatever you want):

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘root‘;

Here is the 8.0.12 version, shown basically as follows:

Windows 64-bit MySQL 5.7 or later package decompression does not have the data directory and My-default.ini and My.ini files, and the service does not start the solution and the method of modifying the initial password

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.