mysql 5.6.26 winx64安裝配置圖文教程(一)
閱讀目錄
• 下載MySQL免安裝版
• 配置MySQL數(shù)據(jù)庫
• MySQL環(huán)境變量
• 安裝MySQL數(shù)據(jù)庫
公司服務器是Windows 開發(fā)連接的數(shù)據(jù)庫使用的是"MySQL"
此篇隨筆將介紹在Windows上如何配置MySQL數(shù)據(jù)庫免安裝版
一、下載MySQL免安裝版
• 首先進入MySQL 官方網(wǎng)站 www.mysql.com -->Downloads(下載) --> Community(社區(qū)) --> MySQL Community Server(MySQL社區(qū)服務器)-->選擇操作系統(tǒng)平臺(Windows)
• 下面有三個可選的下載文件
† 第一個是MySQL Installer 5.6 for Windows,下載下來是一個.msi可執(zhí)行安裝文件
† 后面兩個是解壓版(Zip版)分別是Windows (x86, 64-bit) ZIP Archive 和 Windows (x86, 32-bit), ZIP Archive
• 筆者選擇的是 mysql-5.6.26-winx64.zip ,因為筆者的服務器版本是64位操作系統(tǒng)
二、配置MySQL數(shù)據(jù)庫
• 將下載的 mysql-5.6.26-winx64.zip 解壓自定義目錄,這里筆者將把這個壓縮包解壓至 D:\mysql-5_x64 目錄;
• 打開這個目錄,發(fā)現(xiàn)里面的文件夾和文件跟一個安裝好后的MySQL基本沒有區(qū)別
• 修改MySQL配置文件,在mysql-5_x64目錄下有一個my-default.ini,可以算作模板來使用,里面的內(nèi)容不是很多!可以自己創(chuàng)建一個 my.ini作為MySQL配置文件,打開my.ini
[client]
port=3306
#客戶端字符類型,與服務端一致就行,建議utf8
default-character-set=utf8
[mysqld]
#綁定IPv4和3306端口
bind-address = 0.0.0.0
port = 3306
#服務端字符類型,建議utf8
character_set_server=utf8
# 設置mysql的安裝目錄
basedir=D:/mysql-5_x64
# 設置mysql數(shù)據(jù)庫的數(shù)據(jù)的存放目錄
datadir=D:/mysql-5_x64/data
# 允許最大連接數(shù)
max_connections=201
• 這樣一個基本的MySQL環(huán)境所需要的參數(shù)就夠了
三、MySQL環(huán)境變量
• 右擊這臺電腦-->屬性-->高級-->環(huán)境變量-->"用戶變量"新建變量MYSQL_HOME 值D:\mysql-5_x64 ,"系統(tǒng)變量"找到變量path 編輯 在后面加上 ;%MYSQL_HOME%\bin
四、安裝MySQL數(shù)據(jù)庫
• 運行cmd (Win8 、Win10以管理員運行cmd)-->進入D:\mysql-5_x64\bin目錄
Microsoft Windows [版本 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Windows\system32>D:
D:\>cd mysql-5_x64
D:\mysql-5_x64>cd bin
D:\mysql-5_x64\bin>
• 執(zhí)行mysqld -install 安裝MySQL
D:\mysql-5_x64\bin>mysqld -install
Service successfully installed
• 執(zhí)行net start mysql啟動MySQL
D:\mysql-5_x64\bin>net start mysql
D:\mysql-5_x64\bin>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經(jīng)啟動成功
啟動MySQL服務:net start mysql
停止MySQL服務:net stop mysql
刪除MySQL服務:sc delete mysql
• 修改Mysql密碼
D:\mysql-5_x64\bin>mysql -u root -p //使用root登入mysql
Enter password: //密碼空,回車即可
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.26 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>
mysql> show databases; //顯示所有數(shù)據(jù)庫 +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)
• 進入'mysql'數(shù)據(jù)、刪除空用戶
mysql> use mysql; Database changed mysql> delete from user where user=''; Query OK, 1 row affected (0.00 sec)
• 更新密碼并重新刷權限表到內(nèi)存(也可以用mysqladmin工具來設置密碼)
mysql> update User set Password=PASSWORD('123456') where User='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
• 嘗試登陸
D:\mysql-5_x64\bin>mysql -u root -p //用root用戶登入數(shù)據(jù)庫 Enter password: ****** //輸入更新后的密碼 123456 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.6.26 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>
• 開啟遠程連接(給予全部權限,允許 192.168.1.x 網(wǎng)段都可以連接)
mysql> grant all privileges on *.* to 'root'@'192.168.1.%' identified by 'root' with grant option; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> select host,user,password from user; +-------------+------+-------------------------------------------+ | host | user | password | +-------------+------+-------------------------------------------+ | 192.168.1.% | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | +-------------+------+-------------------------------------------+ 4 rows in set (0.00 sec)
精彩專題分享:
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
MySQL自動填充create_time和update_time的兩種方式
當我們創(chuàng)建業(yè)務表的時候 通常都需要設置create_time 和 update_time,下面這篇文章主要給大家介紹了關于MySQL自動填充createTime和updateTime的兩種方式,需要的朋友可以參考下2022-05-05
MySQL5.6 Replication主從復制(讀寫分離) 配置完整版
這篇文章主要介紹了MySQL5.6 Replication主從復制(讀寫分離) 配置完整版,需要的朋友可以參考下2016-04-04
idea連接mysql數(shù)據(jù)庫失敗的幾種解決方案
我們在學習Mybatis時需要連接Mysql數(shù)據(jù)庫,使用IDEA無法連接mysql數(shù)據(jù)庫,下面這篇文章主要給大家介紹了關于idea連接mysql數(shù)據(jù)庫失敗的幾種解決方案,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2023-06-06
MySQL高級篇之索引的數(shù)據(jù)結(jié)構詳解
在MySQL中索引屬于存儲引擎級別的概念,不同存儲引擎對索引的實現(xiàn)方式是不同的,下面這篇文章主要給大家介紹了關于MySQL高級篇之索引數(shù)據(jù)結(jié)構的相關資料,需要的朋友可以參考下2022-05-05
mysql 使用inet_aton和inet_ntoa處理ip地址數(shù)據(jù)的實例
下面小編就為大家?guī)硪黄猰ysql 使用inet_aton和inet_ntoa處理ip地址數(shù)據(jù)的實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-04-04

