這篇文章主要介紹了windows中MySQL 5.7如何綠色安裝,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
成都創(chuàng)新互聯(lián)專(zhuān)注于網(wǎng)站建設(shè),為客戶(hù)提供成都做網(wǎng)站、網(wǎng)站建設(shè)、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)開(kāi)發(fā)服務(wù),多年建網(wǎng)站服務(wù)經(jīng)驗(yàn),各類(lèi)網(wǎng)站都可以開(kāi)發(fā),成都品牌網(wǎng)站建設(shè),公司官網(wǎng),公司展示網(wǎng)站,網(wǎng)站設(shè)計(jì),建網(wǎng)站費(fèi)用,建網(wǎng)站多少錢(qián),價(jià)格優(yōu)惠,收費(fèi)合理。
1.1 下載
http://dev.mysql.com/downloads/mysql/ 下載地址,在下拉框中選擇相應(yīng)的版本
1.2 安裝
下載下來(lái)的綠色安裝包,直接解壓為E:\mysql
1.3 編輯my.ini文件,
將mydefault.ini copy一份出來(lái),就該其中的參數(shù).
在mysqld中加入如下內(nèi)容
basedir="E:\mysql\"
datadir="E:\mysql\data"
port=3306
#skip-grant-tables
E:\mysql\bin>mysqld --initialize
2016-09-06T13:57:01.349392Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
deprecated. Please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2016-09-06T13:57:01.353393Z 0 [ERROR] --initialize specified but the data direct
ory has files in it. Aborting.
2016-09-06T13:57:01.354393Z 0 [ERROR] Aborting
出現(xiàn)了如上錯(cuò)誤,是由于之前在 data文件夾中有文件導(dǎo)致的,刪掉data下所有的文件,重新執(zhí)行mysqld.exe –initialize命令ok
E:\mysql\bin>mysqld.exe --initialize
E:\mysql\bin>mysqld.exe --install
Service successfully installed.
E:\mysql\bin>net start mysql
MySQL 服務(wù)正在啟動(dòng) .
MySQL 服務(wù)已經(jīng)啟動(dòng)成功。
E:\mysql\bin>mysql -h localhost -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
1.4修改密碼
沒(méi)辦法修改密碼吧
在mysqld下加入
skip-grant-tables
E:\mysql\bin>net stop mysql
MySQL 服務(wù)正在停止.
MySQL 服務(wù)已成功停止。
E:\mysql\bin>net start mysql
MySQL 服務(wù)正在啟動(dòng) .
MySQL 服務(wù)已經(jīng)啟動(dòng)成功。
E:\mysql\bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.14 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>
mysql> update user set password=password("mysql") where user="root";
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
出現(xiàn)這個(gè)錯(cuò)誤是由于mysql 5.7后password欄位變成authentication_string
mysql> update user set authentication_string=password("mysql") where user="root"
;
Query OK, 1 row affected, 1 warning (0.10 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
將my.ini中的skip-grant-tables注釋掉,重啟mysql服務(wù)
E:\mysql\bin>mysql -h localhost -u root -p
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.14
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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo
re executing this statement.
mysql> alter user 'root'@'localhost' identified by 'mysql';
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“windows中Mysql 5.7如何綠色安裝”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!