在 windows 上安裝免安裝版的mysql

在 windows 上安裝免安裝版的html

一、 下載路徑 https://downloads.mysql.com/archives/community/mysql

二、 解壓
假設解壓後的路徑爲:E:\Environment\mysql-5.6.30-winx64
在path環境變量下加入:E:\Environment\mysql-5.6.30-winx64\binsql

三、複製 my-default.ini ,生成 my.ini
在 [mysqld] 下面 加入 指定配置
port=3306
character_set_server=utf8
basedir=E:\Environment\mysql-5.6.30-winx64
datadir=E:\Environment\mysql-5.6.30-winx64\datawindows

完整my.ini 文件以下ide

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** 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]

# 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

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....


# 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 

[client]
port=3306
default-character-set=utf8

[mysqld]
port=3306

character_set_server=utf8
#character_set_server=utf8 必定要這樣寫;

basedir=E:\Environment\mysql-5.6.30-winx64
#解壓目錄

datadir=E:\Environment\mysql-5.6.30-winx64\data
#解壓目錄下data目錄,必須爲data目錄

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

四、註冊windows系統服務
將mysql註冊爲windows系統服務
操做以下:
1)從控制檯進入到MySQL解壓目錄下的 bin 目錄下:
2)輸入服務安裝命令:
mysqld install MySQL --defaults-file="D:\Program Files\MySQL\mysql-5.6.16-win32\my.ini"工具

解壓目錄下修改的my.ini文件

安裝成功後會提示服務安裝成功。ui

注:my.ini文件放在MySQL解壓後的根目錄下

移除服務命令爲:mysqld remove

五、啓動MySQL服務
方法一:
啓動服務命令爲:net start mysql
若報錯:MySQL 服務沒法啓動 1067錯誤;查看data目錄下的err文件看錯誤:
2014-02-27 10:50:12 5360 [ERROR] InnoDB: .\ibdata1 can't be opened in read-write mode
2014-02-27 10:50:12 5360 [ERROR] InnoDB: The system tablespace must be writable!
2014-02-27 10:50:12 5360 [ERROR] Plugin 'InnoDB' init function returned error.
2014-02-27 10:50:12 5360 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2014-02-27 10:50:12 5360 [ERROR] Unknown/unsupported storage engine: InnoDB
2014-02-27 10:50:12 5360 [ERROR] Aborting
解決方法:刪除data目錄下的ib_logfile0和ib_logfile1文件。
再次啓動,正常
方法二:
打開管理工具 服務,找到MySQL服務。
經過右鍵選擇啓動或者直接點擊左邊的啓動來啓動服務。spa

六、 修改 root 帳號的密碼
方法一:
剛安裝完成時root帳號默認密碼爲空,此時能夠將密碼修改成指定的密碼。如:123456
c:>mysql –u root
mysql>show databases;
mysql>use mysql;
mysql>update user set password=PASSWORD("新密碼") where user='root';
mysql>FLUSH PRIVILEGES;
mysql>QUITcode

七、設置mysql遠程訪問:
grant all privileges on . to 'root'@'%' identified by 'root用戶的密碼' with grant optionserver

八、 安裝完成。能夠 下載 「Navicat premium 」 來試試 遠程鏈接。

相關文章
相關標籤/搜索