Windows安装MySql服务无法响应控制功能

Windows 上安装 MySQL

Windows 上安装 MySQL 相对来说会较为简单,点击链接 https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-winx64.zip 下载 zip 包。

最新版本可以在 MySQL 下载 中下载中查看。

 

下载完后,我们将 zip 包解压到相应的目录,这里我将解压后的文件夹放在 CC:\web\mysql-8.0.17-winx64下。

接下来我们需要配置下 MySQL 的配置文件

打开刚刚解压的文件夹C:\web\mysql-8.0.17-winx64 ,在该文件夹下创建 my.ini 配置文件,编辑 my.ini 配置以下基本信息:

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=C:\\web\\mysql-8.0.17-winx64
#切记此处一定要用双斜杠\\,单斜杠我这里会出错,不过看别人的教程,有的是单斜杠。自己尝试吧
# 设置mysql数据库的数据的存放目录
datadir=C:\\web\\mysql-8.0.17-winx64\\data    #我不知道这里要不要设置,一开始的问题我以为是这里
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8

 

然后开始网上所说的命令:

C:\Users\Administrator>cd  C:\web\mysql-8.0.17-winx64

C:\web\mysql-8.0.17-winx64>cd bin

C:\web\mysql-8.0.17-winx64\bin>mysqld --initialize --console
2019-08-22T11:10:04.129559Z 0 [System] [MY-013169] [Server] C:\web\mysql-8.0.17-
winx64\bin\mysqld.exe (mysqld 8.0.17) initializing of server in progress as proc
ess 4324
2019-08-22T11:10:04.133559Z 0 [Warning] [MY-013242] [Server] --character-set-ser
ver: 'utf8' is currently an alias for the character set UTF8MB3, but will be an
alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to
 be unambiguous.
2019-08-22T11:10:32.075157Z 5 [Note] [MY-010454] [Server] A temporary password i
s generated for root@localhost: sSw#mgSap3>j
2019-08-22T11:10:43.377804Z 0 [System] [MY-013170] [Server] C:\web\mysql-8.0.17-
winx64\bin\mysqld.exe (mysqld 8.0.17) initializing of server has completed

C:\web\mysql-8.0.17-winx64\bin>mysqld install
The service already exists!
The current server installed: C:\web\mysql-8.0.17-winx64\bin\mysqld MySQL

C:\web\mysql-8.0.17-winx64\bin>net start mysql
服务没有响应控制功能。

请键入 NET HELPMSG 2186 以获得更多的帮助。

###############################

出现这个问题很无语,以为安装错了或者目录设置错了,或者my.ini少了\\,或者初始化错了,最后搞了一下午,发现直接输入

mysqld --console服务端就开好了:

C:\web\mysql-8.0.17-winx64\bin>mysqld --console
2019-08-22T11:13:12.118311Z 0 [System] [MY-010116] [Server] C:\web\mysql-8.0.17-
winx64\bin\mysqld.exe (mysqld 8.0.17) starting as process 4200
2019-08-22T11:13:12.125312Z 0 [Warning] [MY-013242] [Server] --character-set-ser
ver: 'utf8' is currently an alias for the character set UTF8MB3, but will be an
alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to
 be unambiguous.
2019-08-22T11:13:16.860582Z 0 [Warning] [MY-010068] [Server] CA certificate ca.p
em is self signed.
2019-08-22T11:13:17.482618Z 0 [System] [MY-010931] [Server] C:\web\mysql-8.0.17-
winx64\bin\mysqld.exe: ready for connections. Version: '8.0.17'  socket: ''  por
t: 3306  MySQL Community Server - GPL.
2019-08-22T11:13:17.571623Z 0 [System] [MY-011323] [Server] X Plugin ready for c
onnections. Bind-address: '::' port: 33060
 

接着客户端就可以连接了:

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>cd c:\web\mysql-8.0.17-winx64\bin

c:\web\mysql-8.0.17-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.17

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql>
mysql>
 

相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页