在mysql官網(wǎng)下載數(shù)據(jù)庫和ODBC驅(qū)動
默認(rèn)安裝
重命名my-default.init為my.ini金踪,內(nèi)容如下
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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
[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 = .....
basedir = "D:\soft\MySQL\MySQL Server 5.7"
datadir = "D:\soft\MySQL\MySQL Server 5.7\data"
# 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
初始化和啟動Mysql服務(wù)
1.以管理員權(quán)限運行cmd
2.進(jìn)入mysql的bin下
3.初始化媳拴,生成data文件夾
>mysqld ?--initialize-insecure (不設(shè)置root密碼岸售,建議使用)
>mysqld ?--initialize (生成一個隨機(jī)的root密碼)
3.安裝MySql服務(wù)
>mysqld -install
4.啟動mysql
>net start mysql
登陸mysql
>mysql -u root -p
第一次登錄時無需密碼直接回車登錄
登錄mysql之后,設(shè)置root密碼
>set password for root@localhost = password('YourPassword');
或者使用mysqlamdin修改root密碼
>mysqladmin -u root -p password NewPassword