卸載MySQL5.7版本,安裝5.6版本過程(附mysql5.7版本安裝教程)

 

一、卸載以前舊版本(本人5.7版本)

 

 

1、關閉MySQL服務

 

 

 

以管理員身份運行cmd,執行以下命令: 
net stop mysql

或者右鍵我的電腦,在管理——服務——停止MySQL

2、卸載MySQL應用

mysqld -remove [服務名]
服務名稱可以在右鍵我的電腦,在管理——服務——右鍵點擊MySQL查看屬性找到:如下圖

 

 

3、刪除MySQL文件
下面的將本地MySQL文件刪除掉,路徑可通過上圖服務名稱下面的可執行文件的路徑查到。
 

4、刪除註冊表信息

 

開始->運行-> regedit 看看註冊表裏這幾個地方刪除沒有   

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL 目錄刪除   HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog\Application\MySQL 目錄刪除   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MySQL 目錄刪除

註冊表中的ControlSet001、ControlSet002不一定是001和002,可能是ControlSet005、006之類,刪除的時候都刪除就可以 。

 

完成以上四步即可成功卸載MySQL解壓版環境。

二、安裝MySQL5.6解壓版

1.下載MYSQL的安裝包

可以去官網下載ZIP包,http://www.mysql.com/downloads/mysql/點擊打開鏈接

我安裝的是mysql-5.6.35-winx64


2.解壓到本地目錄

E:\mysql-5.6.35-winx64


3.添加系統環境變量

添加系統環境變量是爲了在命令控制窗口裏更方便點。


新建:MYSQL_HOME ==> E:\mysql-5.6.35-winx64
追加:PATH==> ;%MYSQL_HOME%\bin


4. 修改mysql-5.6.35-winx64的配置文件:my-default.ini
在[mysqld]下追加
-------
basedir=E:\mysql-5.6.35-winx64
datadir=E:\mysql-5.6.35-winx64\data
character-set-server = utf8
-------

5.安裝MySQL5.6應用


保存my-default.ini的配置,

然後打開命令行(開始菜單==>運行==>cmd )
輸入: mysqld --console 然後回車將看到如下類似內容:
-------
C:\Windows\system32>mysqld --console
120410 14:25:22 [Note] Plugin 'FEDERATED' is disabled.
120410 14:25:22 InnoDB: The InnoDB memory heap is disabled
120410 14:25:22 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120410 14:25:22 InnoDB: Compressed tables use zlib 1.2.3
120410 14:25:22 InnoDB: Initializing buffer pool, size = 128.0M
120410 14:25:22 InnoDB: Completed initialization of buffer pool
120410 14:25:22 InnoDB: highest supported file format is Barracuda.
120410 14:25:22 InnoDB: Waiting for the background threads to start
120410 14:25:23 InnoDB: 1.1.8 started; log sequence number 1595675
120410 14:25:23 [Note] Event Scheduler: Loaded 0 events
120410 14:25:23 [Note] mysqld: ready for connections.
Version: '5.5.22' socket: '' port: 3306 MySQL Community Server (GPL)
-------
==> 證明mysql服務已啓動
6. 設置登陸mysql root帳號的的密碼
打開新的命令行,輸入 mysql -uroot 回車
-------
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.22 MySQL Community Server (GPL)


Copyright (c) 2000, 2011, 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. www.2cto.com 


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-------
==〉看到上面類似內容說明登陸成功,此時的root帳號是沒有密碼的
執行命令修改密碼:

use mysql; 
update user set password=PASSWORD("這裏填寫你要設置的密碼") where user='root';


執行完成後退出mysql操作,然後關閉mysql服務,然後重啓mysql服務

然後使用你的root帳號登錄 

命令:mysql -u root -p   //root是用戶名,輸入這條命令按回車鍵後系統會提示你輸入密碼

   //然後你輸入正確的密碼,再按一下回車鍵就可以登錄MySQL數據庫了。

(也可以使用
mysqladmin -u root password 你的密碼       

)  這個應該適用Win7


這樣就可以正常登錄了。

系統爲WIN7,在cmd下使用"net start MySQL"提示"服務名無效,青鍵入net helpmsg 2185 以獲得更多幫助"錯誤

原因是mysql沒有加入到window的服務中

解決方法是命令行進入mysql安裝路徑,輸入mysqld --install

例如  安裝路徑爲D:\Program Files\MySQL,再進去bin目錄,mysqld --install

(安裝路徑爲D:\Program Files\MySQL)

回車,提示成功,接下來,就可以在我的電腦的服務裏面找到mysql服務,去設置自動啓動就OK了。

三、附安裝MySQL5.7解壓版教程

1.下載MYSQL的安裝包

可以去官網下載ZIP包,http://www.mysql.com/downloads/mysql/點擊打開鏈接

2.解壓

解壓到想安裝的目錄下,我的是D:\mysql-5.7.17-winx64

3.添加系統環境變量

添加系統環境變量是爲了在命令控制窗口裏更方便點。


新建:MYSQL_HOME ==>D:\mysql-5.7.17-winx64
追加:PATH==> ;%MYSQL_HOME%\bin

4. 修改mysql-5.7.17-winx64的配置文件:my-default.ini
在[mysqld]下追加
-------
basedir=D:\mysql-5.7.17-winx64
datadir=D:\mysql-5.7.17-winx64\data
character-set-server = utf8
port=3306
-------

5.安裝MySQL5.7應用


保存my-default.ini的配置,

然後打開命令行(開始菜單==>運行==>cmd )
輸入: mysqld --console 然後回車將看到如下類似內容:
-------
C:\Windows\system32>mysqld --console
120410 14:25:22 [Note] Plugin 'FEDERATED' is disabled.
120410 14:25:22 InnoDB: The InnoDB memory heap is disabled
120410 14:25:22 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120410 14:25:22 InnoDB: Compressed tables use zlib 1.2.3
120410 14:25:22 InnoDB: Initializing buffer pool, size = 128.0M
120410 14:25:22 InnoDB: Completed initialization of buffer pool
120410 14:25:22 InnoDB: highest supported file format is Barracuda.
120410 14:25:22 InnoDB: Waiting for the background threads to start
120410 14:25:23 InnoDB: 1.1.8 started; log sequence number 1595675
120410 14:25:23 [Note] Event Scheduler: Loaded 0 events
120410 14:25:23 [Note] mysqld: ready for connections.
Version: '5.7.17' socket: '' port: 3306 MySQL Community Server (GPL)
-------
==> 證明mysql服務已啓動
6. 設置登陸mysql root帳號的的密碼
打開新的命令行,輸入 mysql -uroot 回車
-------
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.17 MySQL Community Server (GPL)


Copyright (c) 2000, 2011, 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. www.2cto.com 


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-------
==〉看到上面類似內容說明登陸成功,此時的root帳號是沒有密碼的
執行命令修改密碼:

use mysql; 

update mysql.user set authentication_string=password('這裏填寫你要設置的密碼') where user='root' and host='localhost';


執行完成後退出mysql操作,然後關閉mysql服務

7.cmd 終端下,進入到mysql安裝目錄,再進去bin目錄,如下圖:

執行 :

mysqld --install MySQL57 --defaults-file="D:\mysql-5.7.17-winx64\my-default.ini"

將mysql服務加入到window的服務中,然後在 我的電腦 - 右鍵 - 管理-在服務中找到mysql -右鍵啓動

然後使用你的root帳號登錄 

打開CMD,命令:mysql -u root -p   //root是用戶名,輸入這條命令按回車鍵後系統會提示你輸入密碼

   //然後你輸入正確的密碼,再按一下回車鍵就可以登錄MySQL數據庫了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章