A quick solution to the problem that there is no data directory and my-default.ini in the unzipped package of Windows 64-bit MySQL 5.7 or above, and the service cannot be started (problem summary)

A quick solution to the problem that there is no data directory and my-default.ini in the unzipped package of Windows 64-bit MySQL 5.7 or above, and the service cannot be started (problem summary)

I am a beginner in SQL and thought that the installation of open source was very simple, but some problems occurred in the process. I recorded them down and hope they can help others.

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

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 for configuring environment variables. This is generally no problem.

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:

Open the cmd command window and go to the bin directory of the MySQL installation directory. Then enter the command mysqld install to display success

Then enter: mysqld --initialize There should be no prompt at this time

Then enter:

net start mysql shows

Finally, the contents of the data folder should be displayed as follows:

Summarize

The above is the quick solution introduced by the editor for the problem that there is no data directory and my-default.ini in the unzipped package of Windows 64-bit MySQL 5.7 or above, and the service cannot be started. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Mysql5.7 my.ini file loading path and data location modification method under windows7
  • Detailed tutorial for installing mysql5.7.21 under Windows
  • Detailed tutorial for installing mysql5.7.21 under Windows system
  • MySQL 5.7.21 installation and configuration method graphic tutorial (window)
  • Tutorial on downloading, installing, configuring and using MySQL under Windows
  • Using MySQL in Windows: Implementing Automatic Scheduled Backups
  • Solution to the problem that MySQL in Windows system cannot input and display Chinese

<<:  CentOS uses local yum source to build LAMP environment graphic tutorial

>>:  How to make your own native JavaScript router

Recommend

Detailed explanation of Zabbix installation and deployment practices

Preface Zabbix is ​​one of the most mainstream op...

MySQL 8.0 DDL atomicity feature and implementation principle

1. Overview of DDL Atomicity Before 8.0, there wa...

Design Theory: A Method to Understand People's Hearts

<br />Once, Foyin and Mr. Dongpo were chatti...

Example of how to set up a Linux system to automatically run a script at startup

Preface Hello everyone, I am Liang Xu. At work, w...

How to Customize Bash Command Prompt in Linux

Preface As we all know, bash (the B ourne-A gain ...

What to do if the auto-increment primary key in MySQL is used up

In the interview, you should have experienced the...

Example code for implementing stacked carousel effect with HTML+CSS+JS

Effect: When the slideshow moves in one direction...

Introduction to the use and advantages and disadvantages of MySQL triggers

Table of contents Preface 1. Trigger Overview 2. ...

Vue implements a movable floating button

This article example shares the specific code of ...

Detailed explanation of JavaScript's Set data structure

Table of contents 1. What is Set 2. Set Construct...

Two methods to disable form controls in HTML: readonly and disabled

In the process of making web pages, we often use f...

How to manage multiple projects on CentOS SVN server

One demand Generally speaking, a company has mult...