mysql 5.7壓縮包安裝筆記


轉載請注明出處http://www.cnblogs.com/havedream/p/5075263.html

重裝系統之后准備安裝mysql,看到官網上有mysql 5.7.10可以下載就點了,然后就開始了漫長的安裝路程,總共折騰差不多一個多小時,最后終於安裝成功了,這里把安裝過程寫下來,給自己做個筆記,也給后來人一個安裝提示.

  1.下載安裝包

  直接點擊或者復制之后就可以下載了,不嫌麻煩或者想體驗其他版本的也可以去官網下載,但是請注意,筆記只在5.7.10這個版本下運行成功,其他版本(僅供參考)需要參考官方的安裝文檔!

  http://120.192.95.132/cache/dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-winx64.zip?ich_args=33a24030fa5191a36f50adaf2a0329c5_1_0_0_5_9c71accd314cb3f9f9f6e66f07ef13e42dd4f7c2bf4ea27f34b88c04e33f0945_80de45f03e1c6ffbe40617244bdec41b_1_0&ich_ip=

 

  2.解壓縮文件夾到本地磁盤

  我把文件放在了

C:\Program_Files\mysql-5.7.10-winx64

  3.復制my-default.ini為my.ini

建議復制一份,或者直接把my-default.ini重命名為my.ini

  4.填寫my.ini相關內容

 

basedir=C:\Program_Files\mysql-5.7.10-winx64
datadir=C:\Program_Files\mysql-5.7.10-winx64\data
port=3306

路徑請替換成自己實際路徑!

  5.環境變量

 新增環境變量,如下圖

修改path,注意是修改,增加的是后面我選中的部分

%MYSQL_HOME%\bin;

  6.管理員權限運行[命令提示符]

盡量使用管理員權限運行,否則,可能出現無法安裝或者無法啟動服務等問題!

  7.執行mysql初始化data

mysqld --initialize --console

結果如下:

C:\Windows\system32>mysqld --initialize --console
2015-12-25T03:01:33.140732Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-12-25T03:01:33.140732Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2015-12-25T03:01:33.140732Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2015-12-25T03:01:34.614085Z 0 [Warning] InnoDB: New log files created, LSN=45790
2015-12-25T03:01:34.775606Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-12-25T03:01:34.872089Z 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: ceb98c90-aab3-11e5-8ca7-b870f4733564.
2015-12-25T03:01:34.872089Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2015-12-25T03:01:34.891376Z 1 [Note] A temporary password is generated for root@localhost: +>><=Gs,0spF

請注意,最后一句包含我們所需要的初始化密碼!!!!

   8.安裝mysql服務,並啟動

C:\Windows\system32>mysqld -install
Service successfully installed.

C:\Windows\system32>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。

  9.登錄mysql並修改密碼

請注意,我下面的密碼和上面的那個初始化密碼不一樣了,因為我有重新卸載了服務然后重新執行了一遍 7和8 ,因為上面的密碼提示我無法登錄,"<"無法識別!!!不知道有沒有人知道是為什么?難道隨機的密碼太隨機了?

C:\Windows\system32>mysql -uroot -pih.sQWazK9*7
mysql>  set password for 'root'@'localhost'="你的密碼";
Query OK, 0 rows affected (0.00 sec)

好了,現在退出

mysql> exit
Bye

  10.修改遠程登錄

到上面9 的時候本機已經可以正常使用mysql的功能了,不過如果需要遠程登錄mysql的話需要下面的設置

C:\Windows\system32>mysql -uroot -p你的密碼
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.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> use mysql
Database changed
mysql> select host,user from user;
+-----------+-----------+
| host      | user      |
+-----------+-----------+
| localhost | mysql.sys |
| localhost | root      |
+-----------+-----------+
2 rows in set (0.00 sec)

mysql> update user set host='%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select host,user from user;
+-----------+-----------+
| host      | user      |
+-----------+-----------+
| %         | root      |
| localhost | mysql.sys |
+-----------+-----------+
2 rows in set (0.00 sec)

mysql>

好了,到這里全部完成了,開始你的mysql之旅吧!

轉載請注明出處http://www.cnblogs.com/havedream/p/5075263.html

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM