1. 程式人生 > >windows下安裝mysql5.6解壓版,32位和64位均可

windows下安裝mysql5.6解壓版,32位和64位均可

對於32位和64位都是可以的。

1.複製mysql-5.6.14-win32.zip到D:\目錄下.

2.解壓mysql-5.6.14-win32.zip

3.在D:\mysql-5.6.14-win32下,

複製“my-default.ini”檔案,生成“復件 my-default.ini”檔案。將“復件 my-default.ini”檔案重新命名成“my.ini” 。

修改其中的內容如下:

<pre name="code" class="html"># 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.
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[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 = D:\\mysql-5.6.14-win32
datadir = D:\\mysql-5.6.14-win32\\data
port = 3306
#自定義主機ID識別符,用於主從或多伺服器之間識別,為 一個 int 型別
server_id = 1

character_set_server=utf8

# 最大連線數量
max_connections = 100

#CREATE TABLE 語句的預設表型別,如果不自己指定型別,則使用下行的型別
default-storage-engine = InnoDB

# 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 


二、

D:\mysql-5.6.14-win32\bin配置到環境變數的path路徑中。

三、安裝mysql為windows服務。

d:\mysql-5.6.14-win32\bin\mysqld.exe -install mysql

一定要指定全路徑,否則,可能找不到檔案。

然後啟動mysql服務。

如果是5.7需要先初始化資料庫:

初始化和啟動Mysql服務:

1.以管理員許可權執行cmd

2.進入mysql的bin下

3.初始化,生成data資料夾

 >mysqld  --initialize-insecure (不設定root密碼,建議使用)

 >mysqld  --initialize (生成一個隨機的root密碼)

然後執行net start mysql

四、登入修改mysql密碼

cmd進入命令列

mysql -u root -p

回車 回車

進入資料庫。

use mysql;

select host,user,password from user;

update user set password = PASSWORD('123456A') where user = 'root';

登入mysql之後,設定root密碼

>set password for [email protected] = password('YourPassword');

或者使用mysqlamdin修改root密碼

>mysqladmin -u root -p password NewPassword

最後不要忘記

flush privileges;

更新OK。

exit退出。然後重新登入即可。