您好,登錄后才能下訂單哦!
這篇文章主要介紹了windows中Mysql 5.7如何綠色安裝,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
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í)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。