1. 程式人生 > >mysql-5.6.25免安裝版配置方法

mysql-5.6.25免安裝版配置方法

一、首先要下載mysql-5.6.25-winx64,這裡就不提供下載了

二、解壓在“D:\Mysql“,可以根據自己實際情況選擇,MySQL的全路徑即為:“D:\Mysql\mysql-5.6.25-winx64”

三、配置my.ini檔案,將下面的配置儲存成my.ini,放在“D:\Mysql\mysql-5.6.25-winx64”下

 # 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 locationduring install, and will be replaced if you
 # *** upgrade to a newer version of MySQL.
 [client]  
  port=3306
  default-character-set=utf8

[mysqld]
 port=3306
 character_set_server=utf8

# 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 = D:\Mysql\mysql-5.6.25-winx64
 datadir = D:\Mysql\mysql-5.6.25-winx64\data


# 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 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
[WinMySQLAdmin]
D:\Mysql\mysql-5.6.25-winx64\bin\mysqld.exe

對於上面的配置路徑,要根據實際情況進行變化

四、配置環境變數

1)右鍵單擊我的電腦->屬性->高階系統設定(高階)->環境變數

新建系統變數:MYSQL_HOME

值為MySQL的解壓路徑:D:\Mysql\mysql-5.6.25-winx64

2)編輯環境變數path

path的最前面加"%MYSQL_HOME%\bin;",然後確定

注意如果新增在path的前面,要注意後面的分號,一定要有;如果新增path的前面,要注意前面一定要有分號

五、註冊MySQL服務

1)以管理員身份執行命令提示符,切換到MySQL的解壓路徑下的bin目錄,D:\Mysql\mysql-5.6.25-winx64\bin>

2)註冊服務:D:\Mysql\mysql-5.6.25-winx64\bin>mysqld install MySQL--defaults-file="D:\Mysql\mysql-5.6.25-winx64\my.ini"

3)啟動MySQL服務

以管理員身份執行命令提示符,然後執行:net start mysql

六、修改MySQL root的密碼

C:\Users\user>mysql–uroot

mysql>show databases;

mysql>use mysql;

mysql>UPDATE user SET password=PASSWORD("123456")WHERE user='root';

mysql>FLUSH PRIVILEGES;

mysql>QUIT

七、幫助

1如果要解除安裝MySQL服務,D:\Mysql\mysql-5.6.25-winx64\bin>mysqld remove

2)停止MySQL服務:net stop mysql

3)在啟動MySQL服務的時候可能會遇到1067 的錯誤,可以檢查向下碟符配置的是否正確,或者更換路徑