共計 2779 個字符,預計需要花費 7 分鐘才能閱讀完成。
這篇文章主要介紹了 windows 中 Mysql 5.7 如何綠色安裝,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓丸趣 TV 小編帶著大家一起了解一下。
1.1
下載
http://dev.mysql.com/downloads/mysql/
下載地址, 在下拉框中選擇相應的版本
1.2
安裝
下載下來的綠色安裝包,直接解壓為 E:\mysql
1.3
編輯 my.ini 文件,
將 mydefault.ini copy 一份出來,就該其中的參數.
在 mysqld 中加入如下內容
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
出現了如上錯誤,是由于之前在
data 文件夾中有文件導致的,刪掉 data 下所有的文件,重新執行 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
服務正在啟動
.
MySQL
服務已經啟動成功。
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 修改密碼
沒辦法修改密碼吧
在 mysqld 下加入
skip-grant-tables
E:\mysql\bin net stop mysql
MySQL
服務正在停止.
MySQL
服務已成功停止。
E:\mysql\bin net start mysql
MySQL
服務正在啟動
.
MySQL
服務已經啟動成功。
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
出現這個錯誤是由于 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 服務
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)
感謝你能夠認真閱讀完這篇文章,希望丸趣 TV 小編分享的“windows 中 Mysql 5.7 如何綠色安裝”這篇文章對大家有幫助,同時也希望大家多多支持丸趣 TV,關注丸趣 TV 行業資訊頻道,更多相關知識等著你來學習!