XXXXX
C/C++
XXXXX
C#/.net
XXXXX
js
java
java
开发导航 开发导航 www.endv.cn
天云

mysql 5.7 非正常安装,无法启动 服务没有报告任何错误

以前,完整安装mysql5.7程序时,由于程序太大,可以将安装缓存目录中的安装文件(较小)复制出来后,留以后使用。

 1 mysql-5.7.17-win32.msi
 2 mysql-5.7.17-winx64.msi   主程序
 3 mysql-connector-c++-1.1.7-win32.msi
 4 mysql-connector-c++-1.1.7-winx64.msi
 5 mysql-connector-c-6.1.6-win32.msi
 6 mysql-connector-c-6.1.6-winx64.msi
 7 mysql-connector-java-gpl-5.1.40.msi
 8 mysql-connector-net-6.9.9.msi
 9 mysql-connector-odbc-5.3.6-win32.msi
10 mysql-connector-odbc-5.3.6-winx64.msi
11 mysql-connector-python-2.1.4-py2.7-win32.msi
12 mysql-connector-python-2.1.4-py2.7-winx64.msi
13 mysql-connector-python-2.1.4-py3.3-win32.msi
14 mysql-connector-python-2.1.4-py3.3-winx64.msi
15 mysql-connector-python-2.1.4-py3.4-win32.msi
16 mysql-connector-python-2.1.4-py3.4-winx64.msi
17 mysql-documents-5.7.17.msi
18 mysql-examples-5.7.17.msi
19 mysql-for-excel-1.3.6.msi
20 mysql-for-visualstudio-1.2.6.msi
21 mysql-notifier-1.1.7.msi
22 mysql-utilities-1.6.4-win32.msi
23 mysql-utilities-1.6.4-winx64.msi
24 mysql-workbench-community-6.3.8-win32.msi
25 mysql-workbench-community-6.3.8-winx64.msi  管理工具

安装了上述两个文件(只安装主程序即可)

安装后,发现mysql根本无法启动,系统服务中也找不到mysql服务,在cmd中执行命令遇到如下问题

mysql无法启动 服务没有报告任何错误 

解决办法

1 不能自己创建一个data文件夹。如果有,请删除 

2 打开cmd命令工具:

在mysql的bin目录下执行mysqld --initialize-insecure (不设置root密码,建议使用)命令,第一次执行这个命令会等待的时间稍微长了一些,并且控制台没有任何返回结果。可以看到mysql的根目录下会多出一个data文件夹,里面一堆文件。

3  执行命令 mysqld -install  安装服务
4 执行命令net start mysql命令来启动Mysql服务

登录时需要用随机密码登录,然后通过以下命令修改密码

SET PASSWORD = PASSWORD('Abcd1234');

 之后,就可以使用 mysql-workbench 管理数据库了

看红色的部分为正解

 1 Microsoft Windows [版本 10.0.15063]
 2 (c) 2017 Microsoft Corporation。保留所有权利。
 3 
 4 C:\Windows\system32>cd C:\Program Files\MySQL\MySQL Server 5.7\bin
 5 
 6 C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld -install
 7 Service successfully installed.
 8 
 9 C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
10 MySQL 服务正在启动 .
11 MySQL 服务无法启动。
12 
13 服务没有报告任何错误。
14 
15 请键入 NET HELPMSG 3534 以获得更多的帮助。
16 
17 
18 C:\Program Files\MySQL\MySQL Server 5.7\bin> NET HELPMSG 3534
19 
20 服务没有报告任何错误。
21 
22 
23 C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld  --initialize-insecure
24 
25 C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -hlocalhost -uroot -p  
26 Enter password: //直接回车
27 ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061) 
28
29 C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql 30 MySQL 服务正在启动 . 31 MySQL 服务已经启动成功。
32
33
34 C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -hlocalhost -uroot -p
35 Enter password:
36 Welcome to the MySQL monitor. Commands end with ; or \g.
37 Your MySQL connection id is 3
38 Server version: 5.7.17 MySQL Community Server (GPL)
39
40 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
41 42 Oracle is a registered trademark of Oracle Corporation and/or its
43 affiliates. Other names may be trademarks of their respective
44 owners.
45
46 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
47
48 mysql> SET PASSWORD = PASSWORD('Abcd1234');
49 Query OK, 0 rows affected, 1 warning (0.00 sec)
50
51 mysql>

 第二次安装完整流程:

1、安装主程序

2、进入命令行操作:

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

C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server 5.7\bin

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize-insecure

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld -install
Service successfully installed.

C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。


C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -hlocalhost -uroot -p
Enter password://直接回车
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> SET PASSWORD = PASSWORD('Abcd1234');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>

3、可以正常访问了...

 

posted @ 2019-07-21 21:58  Endv  阅读(1780)  评论(0编辑  收藏  举报