Mysql 5.7.22 install for windows

chenoracle發表於2018-06-20

Mysql 5.7.22 install for windows

 

一:下載
下載地址
dev.mysql.com/downloads/mysql

安裝包名稱

mysql-5.7.22-winx64.zip


二:解壓mysql-5.7.22-winx64.zip


:my.ini

D:\mysql\mysql-5.7.22-winx64目錄下新建my.ini檔案,內容如下:

[mysql]

# 設定mysql客戶端預設字符集

default-character-set=utf8

[mysqld]

#設定3306

port = 3306

# 設定mysql的安裝目錄

basedir=D:\mysql\mysql-5.7.22-winx64

# 設定mysql資料庫的資料的存放目錄

datadir=D:\mysql\mysql-5.7.22-winx64\data 

# 允許最大連線數

max_connections=200

# 服務端使用的字符集預設為8位元編碼的latin1字符集

character-set-server=utf8

# 建立新表時將使用的預設儲存引擎

default-storage-engine=INNODB


:初始化

D:\mysql\mysql-5.7.22-winx64\bin>mysqld --initialize --user=mysql --console

2018-06-20T07:48:39.780714Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is

 deprecated. Please use --explicit_defaults_for_timestamp server option (see doc

umentation for more details).

2018-06-20T07:48:41.244714Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-06-20T07:48:41.749714Z 0 [Warning] InnoDB: Creating foreign key constraint

system tables.

2018-06-20T07:48:41.891714Z 0 [Warning] No existing UUID has been found, so we a

ssume that this is the first time that this server has been started. Generating

a new UUID: 59e7dc2e-745e-11e8-ae3b-2c6fc91b2aca.

2018-06-20T07:48:41.939714Z 0 [Warning] Gtid table is not ready to be used. Tabl

e 'mysql.gtid_executed' cannot be opened.

2018-06-20T07:48:41.965714Z 1 [Note] A temporary password is generated for root@

localhost: 4p?LswtPSJqh


五:安裝服務

D:\mysql\mysql-5.7.22-winx64\bin>mysqld -install

Service successfully installed.


六:啟動服務

D:\mysql\mysql-5.7.22-winx64\bin>net start mysql

MySQL 服務正在啟動 .

MySQL 服務已經啟動成功。


七:登陸資料庫

D:\mysql\mysql-5.7.22-winx64\bin>mysql -uroot -p"4p?LswtPSJqh"

mysql: [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 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.


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 '123';

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)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2156381/,如需轉載,請註明出處,否則將追究法律責任。

相關文章