Home > Database > Mysql Tutorial > body text

How to solve the problem that mysql service cannot be started

王林
Release: 2020-06-11 10:20:04
Original
36370 people have browsed it

How to solve the problem that mysql service cannot be started

Problem description:

When trying to install MYSQL under win7, the following error occurred:

How to solve the problem that mysql service cannot be started

Solution Method:

1. Add environment variable PATH (for example: C:\Program Files\mysql-5.7.13-winx64\bin);

2 , enter the MYSQL installation directory, create a new default configuration file my.ini;

Write the following content in the my.ini configuration file:

(The specific content can be Modify according to your own situation)

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=C:\Program Files\mysql-5.7.13-winx64
# 设置mysql数据库的数据的存放目录
datadir=C:\Program Files\mysql-5.7.13-winx64\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
Copy after login

Save after completion. At this time, the my.ini file will replace the default my-default.ini file.

After that, we need to manually create a new data folder in the MYSQL installation directory.

3. Uninstall, reinstall, initialize MYSQL, and finally start the MYSQL service;

Run cmd as an administrator and enter the following commands in sequence:

C:Windows\system32>mysqld --remove  //删除mysql服务
C:Windows\system32>mysqld --install //安装mysql服务 
C:Windows\system32>mysqld --initialize //一定要初始化 
C:Windows\system32>net start mysql
Copy after login

After the initialization command is executed, the following files are generated in the empty data directory:

How to solve the problem that mysql service cannot be started

Finally start the MYSQL service. If the following is displayed, it indicates that it has been started successfully.

How to solve the problem that mysql service cannot be started

Recommended tutorial: mysql tutorial

The above is the detailed content of How to solve the problem that mysql service cannot be started. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!