1. 程式人生 > 實用技巧 >windows下安裝解壓縮mysql

windows下安裝解壓縮mysql

  1. 轉載:http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html


  2. 解壓之後可以將該資料夾改名,放到合適的位置,個人建議把資料夾改名為MySQL Server 5.6,放到C:\Program Files\MySQL路徑中。當然你也可以放到自己想放的任意位置。

    MySQL 5.6 for Windows 解壓縮版配置安裝

  3. 完成上述步驟之後,很多使用者開始使用MySQL,但會出現圖示的錯誤。這是因為沒有配置環境變數所致。配置環境變數很簡單:

    我的電腦->屬性->高階->環境變數

    選擇PATH,在其後面新增: 你的mysql bin資料夾的路徑 (如:C:\Program Files\MySQL\MySQL Server 5.6\bin )

    PATH=.......;C:\Program Files\MySQL\MySQL Server 5.6\bin (注意是追加,不是覆蓋)

    MySQL 5.6 for Windows 解壓縮版配置安裝

    MySQL 5.6 for Windows 解壓縮版配置安裝

  4. 配置完環境變數之後先別忙著啟動mysql,我們還需要修改一下配置檔案(如果沒有配置,之後啟動的時候就會出現圖中的錯誤哦!:錯誤2 系統找不到檔案),mysql-5.6.1X預設的配置檔案是在C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini,或者自己建立一個my.ini檔案,

    在其中修改或新增配置(如圖):

    [mysqld]

    basedir=C:\Program Files\MySQL\MySQL Server 5.6(mysql所在目錄)

    datadir=C:\Program Files\MySQL\MySQL Server 5.6\data (mysql所在目錄\data)

    MySQL 5.6 for Windows 解壓縮版配置安裝

    MySQL 5.6 for Windows 解壓縮版配置安裝

    MySQL 5.6 for Windows 解壓縮版配置安裝

  5. 以管理員身份執行cmd(一定要用管理員身份執行,不然許可權不夠),

    輸入:cd C:\Program Files\MySQL\MySQL Server 5.6\bin進入mysql的bin資料夾(不管有沒有配置過環境變數,也要進入bin資料夾,否則之後啟動服務仍然會報錯誤2)

    輸入mysqld -install(如果不用管理員身份執行,將會因為許可權不夠而出現錯誤:Install/Remove of the Service Denied!)

    安裝成功

    MySQL 5.6 for Windows 解壓縮版配置安裝

    MySQL 5.6 for Windows 解壓縮版配置安裝

  6. 安裝成功後就要啟動服務了,繼續在cmd中輸入:net start mysql(如圖),服務啟動成功!

    此時很多人會出現錯誤,請看注意:

    注意:這個時候經常會出現錯誤2和錯誤1067。

    如果出現“錯誤2 系統找不到檔案”,檢查一下是否修改過配置檔案或者是否進入在bin目錄下操作,如果配置檔案修改正確並且進入了bin資料夾,需要先刪除mysql(輸入 mysqld -remove)再重新安裝(輸入 mysqld -install);

    如果出現錯誤1067,那就是配置檔案修改錯誤,確認一下配置檔案是否正確。

    MySQL 5.6 for Windows 解壓縮版配置安裝

  7. 服務啟動成功之後,就可以登入了,如圖,輸入mysql -u root -p(第一次登入沒有密碼,直接按回車過),登入成功!

    MySQL 5.6 for Windows 解壓縮版配置安裝




Microsoft Windows XP [版本 5.1.2600]

(C) 版權所有 1985-2001 Microsoft Corp.


C:\Documents and Settings\Administrator>d:


D:\>cd d:/Mysql_win32\mysql-5.6.15\bin


D:\Mysql_win32\mysql-5.6.15\bin>mysqld -install

Service successfully installed.


D:\Mysql_win32\mysql-5.6.15\bin>net start mysql

MySQL 服務正在啟動 .........

MySQL 服務已經啟動成功。



D:\Mysql_win32\mysql-5.6.15\bin>mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.15-enterprise-commercial-advanced MySQL Enterprise Server -

Advanced Edition (Commercial)


Copyright (c) 2000, 2013, 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 for [email protected] = password('123456');

Query OK, 0 rows affected (0.09 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)


mysql> quit。

-> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

corresponds to your MySQL server version for the right syntax to use near 'quit

。' at line 1

mysql> quit

Bye


D:\Mysql_win32\mysql-5.6.15\bin>mysql -u root -p123456

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.15-enterprise-commercial-advanced MySQL Enterprise Server -

Advanced Edition (Commercial)


Copyright (c) 2000, 2013, 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>


轉載於:https://blog.51cto.com/526869727/1768544