There is no data directory, my-default.ini and my.ini files in the unzipped package of Windows 64-bit MySQL 5.7 or above, and the solution to the problem that the service cannot be started and the method to change the initial password. MySQL official website download address Take version 5.7.20 as an example First, after the installation package is unzipped, there is no data folder and my-default.ini mentioned in the online tutorial, as shown in the figure below Please refer to the online tutorial to configure the environment variables. This is generally no problem. That is, add the path where the MYSQL decompression package bin is located in the Path of the environment variable. Mine is: D:\softnew\MYSQL\mysql-5.7.20-winx64\bin Pay attention to the following points: (1) It is not important whether the my-default.ini file exists or not. The key is to create a new my.ini file in the root directory. The specific content is as follows: [mysql] # Set the default character set of the mysql client to default-character-set=utf8 [mysqld] #Set port 3306 port = 3306 # Set the installation directory of mysql basedir=D:\\softnew\\MYSQL\\mysql-5.7.20-winx64 # Maximum number of connections allowed max_connections=200 # The default character set used by the server is the 8-bit 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 copy and paste directly, mainly modify the path after basedir, note that the path is \\ instead of \ (2) Please do not create a data folder yourself Many tutorials on the Internet suggest creating a new empty data folder and then adding a sentence to the my.ini file: # Set the storage directory of mysql database data datadir=D:\\softnew\\MYSQL\\mysql-5.7.20-winx64\\data This will cause the service to fail to start. Do not add this sentence, and do not create a new data folder yourself. Let mysql automatically generate data. Specifically: 1) Open the cmd command window as an administrator (directly opening cmd to run may result in an error), and enter the bin directory of the MySQL installation directory . Then enter the command mysqld install to display success 2) Enter: mysqld –initialize again. There should be no prompt at this time. 3) Enter again: net start mysql and it will show Finally, the contents of the data folder should be displayed as follows: Note: When you log in to MYSQL for the first time, you will be prompted to enter an initial password. This is for security reasons. The command: mysqld –initialize will randomly generate a password. The initial password is in the xxx.err file in the data folder in the above picture. You can open it with Notepad and use ctrl+f to find the following line of records: [Note] A temporary password is generated for root@localhost: NZ+uhXPq1zN. NZ+uhXPq1zN. is the initial password (note that the . should not be omitted) After entering, you can use the following command to modify it. Here the password is changed to root: ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; This is version 5.7.22, and the display is basically as follows: Thanks! Wonderful topic sharing: MySQL different versions installation tutorial MySQL 5.7 installation tutorials for various versions MySQL 5.6 installation tutorials for various versions mysql8.0 installation tutorials for various versions The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of the pitfalls of Apache domain name configuration
>>: JavaScript mobile H5 image generation solution explanation
As the number of visits increases, the pressure o...
This article mainly introduces the effect of div ...
Table of contents Problem Description Scenario In...
Table of contents 1. Command 2. docker-compose.ym...
Table of contents Precautions Necessary condition...
For several reasons (including curiosity), I star...
Table of contents 1. Numeric Type 1.1 Classificat...
Table of contents npm download step (1) Import (2...
Socket option function Function: Methods used to ...
Preface In a recent project, we need to save a la...
Copy code The code is as follows: <object clas...
In relational databases, pessimistic locking and ...
background A new server was added in the company,...
Table of contents 1. Installation 2. There is no ...
The implementation of custom carousel chart using...