MySQL 5+ 服務手動安裝的方法:運行cmd,進入mysql的安裝目錄:
C:\Users\aministrator> D:
D:\> cd MySQL Server 5.6\bin
D:\MySQL Server 5.6\bin>在bin目錄中運行mysqld.exe -install命令,安裝不完成會有提示信息。#1、手動安裝mysql服務
D:\MySQL Server 5.6\bin>mysqld.exe -install
Service successfully installed.D:\MySQL Server 5.6\bin>#2、開啟服務
D:\MySQL Server 5.6\bin>net start mysql
MySQL 服務正在啟動 .
MySQL 服務無法啟動。系統出錯。發生系統錯誤 1067。進程意外終止。#當發生上面的情況,需要將所有的my.ini全部重命名或刪除,只保留默認的my-default.ini,重新啟動服務即可。
#若還沒有生效,查看mysql服務是否開啟,或將服務刪除再安裝:D:\MySQL Server 5.6\bin>mysqld --removeD:\MySQL Server 5.6\bin>mysqld --install#安裝MySQL庫
D:\MySQL Server 5.6\bin>mysqladmin -u root -p
#開啟MySQL服務
D:\MySQL Server 5.6\bin>net start mysql
#空密碼進入
D:\MySQL Server 5.6\bin>mysql -uroot -p
Enter Password:
#3、
D:\MySQL Server 5.6\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.12 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates.
Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.08 sec)
#若發生上面沒有database mysql的情況,運行bin中的mysqld-config-editor.exe:
D:\MySQL Server 5.6\bin>mysql_config_editor.exe set -u root -p
#自定義密碼后,重新登錄即可。
#4、重新賦予root權限:
mysql>use mysql;
mysql>grant all on *.* to 'root'@'localhost' identified by 'password';
mysql>grant all on *.* to 'root'@'127.0.0.1' identified by 'password';#刪除空密碼用戶
mysql>delete from user where password='';#退出,重新root登錄
<pre name="code" class="csharp">D:\MySQL Server 5.6\bin>mysql -u root -p
Enter password:******
mysql>
?
另一種方案:
ERROR:1045 解決方案:
1、先停止mysql服務
2、在mysql的目錄下找到my.ini,在[mysqld]后面加上skip-grant-tables
3、啟動mysql服務,打開Command Line Client以空密碼登錄
4、退出mysql,并停止服務
5、把my.ini中添加的:skip-grant-tables 去掉
5、再次開啟mysql服務,直接回車登錄,輸入:set password for root@localhost=password('newpwd');
6、退出重新配置,大功告成!
參考資料:
本地無法啟動MySQL服務,報的錯誤:1067,進程意外終止---解決
如何徹底卸載MySQL