1. 程式人生 > >Windows7安裝MySQL5.7.22

Windows7安裝MySQL5.7.22

2、考慮到資料庫容量會增加,建議解壓縮到可用容量較大的碟符,我解壓縮到D盤;

3、進入解壓縮目錄,新建my.ini檔案,內容如下:

[mysqld]
# set basedir to your installation path
basedir=D:/mysql-5.7.22-winx64
# set datadir to the location of your data directory
datadir=D:/mysql-5.7.22-winx64/data

4、使用cmd進入解壓縮目錄下的bin/目錄下

# 安裝mysql服務,安裝完成後,可在右鍵“計算機”-“管理”-“服務”中看到,預設服務名為“MySQL”,也可以在install後面指定服務名稱
D:\mysql-5.7.22-winx64\bin>mysqld install
Service successfully installed.
# 初始化data目錄
D:\mysql-5.7.22-winx64\bin>mysqld.exe --initialize

初始化後會在datadir路徑下生成一個*.err的檔案,開啟如下:

2018-05-27T04:49:08.182952Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-27T04:49:11.016957Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-27T04:49:11.546958Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-27T04:49:11.676958Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4c70979b-6169-11e8-9db4-00ff13a6d817.
2018-05-27T04:49:11.676958Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-27T04:49:11.696958Z 1 [Note] A temporary password is generated for 
[email protected]
: q&10*I#<fi-w

最後一行“A temporary password is generated for [email protected]: q&10*I#<fi-w”冒號後面的就是臨時密碼;

# 啟動MySQL服務
D:\mysql-5.7.22-winx64\bin>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。

5、修改密碼

後面有兩種方式可以修改密碼,一種是使用剛才生成的臨時密碼登入修改,另一種是修改配置檔案跳過密碼登入然後修改密碼;

5.1 通過臨時密碼登入

# 使用臨時密碼登入
E:\mysql-5.7.22-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.22

Copyright (c) 2000, 2018, 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 global variables like 'port';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
# 通過ALTER語句修改密碼
mysql> ALTER user 'root'@'localhost' identified by 'Jiubugaosuni_01';
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW GLOBAL VARIABLES LIKE 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+
1 row in set, 1 warning (0.01 sec)

5.2 跳過密碼登入

5.2.1 跳過密碼登入MySQL

# 停止MySQL服務
D:\mysql-5.7.22-winx64\bin>net stop mysql
MySQL 服務正在停止.
MySQL 服務已成功停止。

# 解除安裝MySQL服務
D:\mysql-5.7.22-winx64\bin>mysqld remove
Service successfully removed.
# 編輯my.ini配置檔案,在[mysqld]下新增skip-grant-tables
[mysqld]
# set basedir to your installation path
basedir=D:/mysql-5.7.22-winx64
# set datadir to the location of your data directory
datadir=D:/mysql-5.7.22-winx64/data
skip-grant-tables
# 安裝MySQL服務
D:\mysql-5.7.22-winx64\bin>mysqld install
Service successfully installed.

# 啟動MySQL服務
D:\mysql-5.7.22-winx64\bin>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。

5.2.2 無密碼登入

D:\mysql-5.7.22-winx64\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.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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>
# 在這裡不能使用ALTER語句,否則報錯
mysql> ALTER user 'root'@'localhost' identified by 'Jiubugaosuni_01';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this
statement
# 而應該使用如下命令,設定臨時密碼
mysql> use mysql;
Database changed
mysql> UPDATE user SET authentication_string = password("Jiubugaosuni_01") WHERE user = "root";
Query OK, 1 row affected, 1 warning (0.07 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> QUIT;
Bye

5.2.3 恢復密碼登入

# 停止MySQL服務
D:\mysql-5.7.22-winx64\bin>net stop mysql
MySQL 服務正在停止.
MySQL 服務已成功停止。

# 解除安裝MySQL服務
D:\mysql-5.7.22-winx64\bin>mysqld remove
Service successfully removed.
# 修改my.ini配置檔案,註釋或者刪除skip-grant-tables
[mysqld]
# set basedir to your installation path
basedir=D:/mysql-5.7.22-winx64
# set datadir to the location of your data directory
datadir=D:/mysql-5.7.22-winx64/data
# skip-grant-tables
# 安裝MySQL服務
D:\mysql-5.7.22-winx64\bin>mysqld install
Service successfully installed.

# 啟動MySQL服務
D:\mysql-5.7.22-winx64\bin>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。

5.2.4 登入並檢視埠號

# 使用修改的臨時密碼登入
D:\mysql-5.7.22-winx64\bin>mysql -u root -p
Enter password: ***************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22

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

# 必須通過ALTER語句修改密碼才算正式修改密碼成功
mysql> show global variables like 'port';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER user 'root'@'localhost' identified by 'Jiubugaosuni_01';
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW GLOBAL VARIABLES LIKE 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+
1 row in set, 1 warning (0.04 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql>

6、配置遠端登入

# 賦予全部許可權在所有資料庫和所有表上給root使用者在任何主機上使用Jiubugaosuni_01這個密碼登入  
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Jiubugaosuni_01' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)

相關推薦

windows7安裝MySQL5.7.22安裝

下載MySQL 選擇對應的版本及作業系統的位數,下載zip壓縮包 解壓壓縮包 例如我解壓到了D:\soft資料夾,路徑是:D:\soft\mysql-5.7.22-winx64 安裝MySQL 1.在解壓目錄裡新建my.in

Windows7安裝MySQL5.7.22

2、考慮到資料庫容量會增加,建議解壓縮到可用容量較大的碟符,我解壓縮到D盤;3、進入解壓縮目錄,新建my.ini檔案,內容如下:[mysqld] # set basedir to your installation path basedir=D:/mysql-5.7.22-w

linux安裝mysql5.7.22詳細步驟

bin port onos text mysql目錄 acea ola utf 參考 參考文檔:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html https://blog.csdn.net/ma

Ubuntu16.04安裝MySQL5.7.22

mysql5.7 oot 執行命令 獲得 登錄 0.11 vmw pan height VMware12.0+Ubuntu16.04+MySQL5.7.22安裝 首先使用命令sudo -s獲得root權限,後面執行任何命令都不需要每次輸入密碼了。用whereis mysql

SuSE11安裝MySQL5.7.22:RPM安裝方式

efault cal mas 電腦 mic first delet pda space 摘要:SuSE11sp3 64位操作系統、 MySQL5.7.22 rpm安裝包5.7版本與先前版本安裝有所區別,需要註意註:kingtry是我的主機名一、環境準備操作系統:SuSE版本

SuSE11安裝MySQL5.7.22:二進制安裝方式、單實例

als plain ini dump 最好 12.1 glibc processes 安裝 摘要:SuSE11sp3 64位操作系統、 MySQL5.7.22 二進制安裝包、單實例註:kingtry是我的主機名一、環境準備操作系統:SuSE版本11sp3,64位kingtr

SuSE11安裝MySQL5.7.22:編譯安裝說明

如果 -s size too available nbsp 編譯安裝 threads mcg 說明:mysql5.7.22的編譯安裝需要GCC4.4或者更高版本,但是SuSE11默認版本為4.3.4,查看GCC當前版本如下:kingtry:~ # /lib/libc.so.

SuSE12安裝MySQL5.7.22:編譯安裝方式、單實例

shell rest rom nec dev nta csu resolv memory 摘要:SuSE12.1 64位操作系統、 MySQL5.7.22 編譯安裝、單實例帶boost和不帶boost的編譯安裝註:kingtry是我的主機名一、環境準備操作系統:SuSE版本

windows環境下安裝MySQL5.7.22安裝

1 下載MySQL 網址:https://dev.mysql.com/downloads/mysql/ 選擇對應的版本及作業系統的位數,下載zip壓縮包 2 解壓壓縮包 例如我解壓到了D:\soft資料夾,路徑是:D:\soft\mysql-5.7.22-winx

linux centos7下原始碼 tar安裝mysql5.7.22mysql5.7.20 圖文詳解

之前用的rpm安裝的每次安裝都是最新的,,,導致每次版本不統一。。。 現在用tar包安裝5.7.22和5.7.20一樣的   5.7.20之後的和之前的版本還是有點不一樣的 1.   cd /usr/local/src  wget https://cdn.mysql.co

(不好用你打我!)linux centos7下原始碼 tar安裝mysql5.7.22mysql5.7.20 圖文詳解

之前用的rpm安裝的每次安裝都是最新的,,,導致每次版本不統一。。。 現在用tar包安裝5.7.22和5.7.20一樣的   5.7.20之後的和之前的版本還是有點不一樣的 1.   cd /usr/local/src  

Win10安裝MySQL5.7.22 解壓縮版(手動配置)方法

 直接點選下載項 下載後: 2.可以把解壓的內容隨便放到一個目錄,我的是如下目錄(放到C盤的話,可能在修改ini檔案時涉及許可權問題,之後我就改放D盤了): D:\MySQL\MySQL Server 5.7.22 如下圖:此時加壓後的檔案中沒有data目錄和ini檔案  3.在D:\

CentOS7.5安裝Java+Mysql+Nginx+Tomcat(一)安裝MySQL5.7.22

CentOS7.5安裝MySQL5.7.22(新伺服器) 1、獲取MySQL安裝包    ①下載安裝包    訪問https://dev.mysql.com/downloads/mysql/5.7.html#downloads,選擇MySQL版本5.7.22,系統選擇R

win10安裝mysql5.7.22過程遇到登陸及修改密碼問題解決辦法

1.安裝參考部落格https://www.cnblogs.com/xiaxiaoxu/p/8977418.html2.登陸過程中遇到MySQL 5.7版 解決密碼登入失敗Access denied for user 'root'@'localhost' (using pass

Win10 安裝 MySQL5.7.22 解壓版 64位

1.官網下載地址https://dev.mysql.com/downloads/mysql/5.7.html#downloads2.解壓檔案直接解壓到你指定的資料夾裡(注意:解壓的目錄裡沒有data和ini檔案),比如D:\MySQL573.建立ini檔案,填寫內容如下:[c

中標麒麟作業系統安裝MySQL5.7.22

中標麒麟作業系統為國產作業系統,預裝了MySQL,不同於CentOS可直接安裝MySQL。/etc/my.cnf已經存在,在安裝時,首先執行命令mv /etc/my.cnf /etc/my.cnf.bak不然在安裝的時候會報各種各樣的錯誤。執行完上述命令後,可以開始安裝MyS

Windows7 安裝MySQL5.7解壓縮版及所遇到的問題與解決

Windows7 安裝MySQL5.7       啟動服務時報錯:       MYSQL 服務無法啟動 服務沒有報告任何錯誤 啟動後設置密碼mysql -u root –p root       登入       輸入密碼報ERROR1045 (28000): A

centos6.7安裝mysql5.6.22同時解決中文亂碼問題

系統服務 iptable nod -- 1.7 亂碼問題 dport 5.6 復制 1.下載 http://dev.mysql.com/downloads/mysql/ 或者使用wget下載: wget http://dev.mysql.com/get/Do

mysql5.7.22源碼編譯安裝

.so layout edi AI img 5.7 onf ali file mkdir /tools && cd /tools mysql下載https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.

mysql5.7.22二進制安裝

配置 edi safe commit hotcopy share 改密碼 修改 english 系統版本:centos6.5 內核:2.6第一步初始化: ./bin/mysqld --initialize --user=mysql --datadir=數據存放路徑 --b