下載MySQL Community Server 5.6.13
成都創(chuàng)新互聯(lián)公司專(zhuān)注于右江企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè)公司,商城網(wǎng)站建設(shè)。右江網(wǎng)站建設(shè)公司,為右江等地區(qū)提供建站服務(wù)。全流程按需網(wǎng)站開(kāi)發(fā),專(zhuān)業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)公司專(zhuān)業(yè)和態(tài)度為您提供的服務(wù)
解壓MySQL壓縮包
將以下載的MySQL壓縮包解壓到自定義目錄下,我的解壓目錄是:
"D:\Program Files\MySQL\mysql-5.6.13-win32"
添加環(huán)境變量
操作如下:
1)右鍵單擊我的電腦-屬性-高級(jí)系統(tǒng)設(shè)置(高級(jí))-環(huán)境變量
點(diǎn)擊系統(tǒng)變量下的新建按鈕
輸入變量名:MYSQL_HOME
輸入變量值:D:\Program Files\mysql-5.6.11-winx64
#即為mysql的自定義解壓目錄。
2)選擇系統(tǒng)變量中的Path
點(diǎn)擊編輯按鈕
在變量值中添加變量值:%MYSQL_HOME%\bin
注意是在原有變量值后面加上這個(gè)變量,用;隔開(kāi),不能刪除原來(lái)的變量值,
1.
下載MySQL壓縮包 下載地址:MySQL :: Download MySQL Community Server (Archived Versions) 此處下載的是MySQL的5.7.31版本,windows,64位。 下載得到的zip壓縮包:
2.
安裝mysql mysql-5.3.71-winx64.zip是免安裝的版本。 解壓zip文件 將解壓后的壓縮包文件放入路徑(不要有中文路徑)(這里我放在了D:Program Files下)
3.
創(chuàng)建配置文件 在mysql安裝目錄下,創(chuàng)建一個(gè)my.ini配置文件,
安裝MySQLmysql-5.6.14可以參考如下安裝步驟:
1、將解壓縮后的文件放到自己想要的地方,并配置環(huán)境變量。示例中存放的目錄為:F:\mysql\mysql-5.6.14-winx64
2、在環(huán)境變量中添加:MYSQL_HOME:F:\mysql\mysql-5.6.14-winx64,在path路徑中加入:%MYSQL_HOME%\bin。配置環(huán)境變量不是必須的,只是為了能更方便的在命令行中使用mysql的命令行工具。
3、修改ini配置文件
5.6.14的解壓縮版里有一個(gè)my-default.ini文件,copy一份改名為my.ini放在同級(jí)目錄下。修改my.ini, my.ini內(nèi)容如下:
# For advice on how to change settings please see
#
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
loose-default-character-set=utf8
basedir = F:/mysql/mysql-5.6.14-winx64
datadir = F:/mysql/mysql-5.6.14-winx64/data
[client]
loose-default-character-set=utf8
[WinMySQLadmin]
Server=F:/mysql/mysql-5.6.14-winx64/bin/mysqld.exe
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# 設(shè)置mysql的安裝目錄
# 設(shè)置mysql數(shù)據(jù)庫(kù)的數(shù)據(jù)存放目錄
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
character-set-server=utf8
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
4、安裝服務(wù)
開(kāi)始——所有程序——附件——命令提示符,右鍵以管理員身份運(yùn)行。 輸入命令:
C:\f:
F:\cd F:\mysql\mysql-5.6.14-winx64\bin
F:\mysql\mysql-5.6.14-winx64\binmysqld -install
Service successfully installed.
5、啟動(dòng)服務(wù)
F:\mysql\mysql-5.6.14-winx64\bincd\
F:\net start mysql
MySQL 服務(wù)正在啟動(dòng) .
MySQL 服務(wù)已經(jīng)啟動(dòng)成功。
6、配置用戶(hù)
還在上面的命令窗口里面,輸入命令:mysql -u root -p
回車(chē)后提示輸入密碼。
mysql解壓縮版初次安裝管理員root的密碼為空,因此直接再回車(chē)一次就登入mysql數(shù)據(jù)庫(kù)了。
F:\mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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.
成功后
輸入命令:use mysql;/*使用mysql數(shù)據(jù)庫(kù)*/
mysql use mysql
Database changed
輸入命令:select host,user,password from user;/* 查看系統(tǒng)的賬戶(hù)信息 */
mysql select host,user,password from user;
+-----------+------+----------+
| host | user | password |
+-----------+------+----------+
| localhost | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
+-----------+------+----------+
4 rows in set (0.00 sec)
host:代表mysql服務(wù)允許哪個(gè)IP來(lái)的請(qǐng)求。localhost和127.0.0.1指mysql服務(wù)所在的主機(jī),即本地。::1是IPV6的IP地址寫(xiě)法,
全稱(chēng)為:0000:0000:0000:0000:0000:0000:0000:0001?,F(xiàn)在都是IPV4的網(wǎng)絡(luò),可以不用管他。
user:指賬戶(hù)名稱(chēng)。不同的host下賬戶(hù)名稱(chēng)可以相同。
password:密碼。
可以看到,默認(rèn)賬戶(hù)里只支持本地連接,并且賬戶(hù)沒(méi)有密碼?,F(xiàn)在的問(wèn)題明確了,就是要將匿名用戶(hù)刪除,為root用戶(hù)添加遠(yuǎn)程訪(fǎng)問(wèn)和密碼,再為自己添加個(gè)人賬戶(hù)。指令如下:
mysql update user set password=PASSWORD('root') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql grant all on *.* to root@'%' identify by 'root';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by 'root'' at line 1
mysql grant all on *.* to walle@'%' identify by '123456' with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'ident
ify by '123456' with grant option' at line 1
mysql delete from where user='';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'where
user=''' at line 1
mysql select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 127.0.0.1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| ::1 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| localhost | | |
+-----------+------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql commit;
Query OK, 0 rows affected (0.00 sec)
mysql flush privileges;
Query OK, 0 rows affected (0.00 sec)
1、到mysql官網(wǎng)下載mysql-5.6.14-winx64.zip。
2、將解壓縮后的文件放到自己想要的地方,并配置環(huán)境變量。例如我存放的目錄為:F:\mysql\mysql-5.6.14-winx64。
3、修改ini配置文件。
5.6.14的解壓縮版里有一個(gè)my-default.ini文件,copy一份改名為my.ini放在同級(jí)目錄下。
4、安裝服務(wù)。
5、啟動(dòng)服務(wù)。
6、配置用戶(hù)。