1、mysql是經過DOS命令方式操做的,因此須要讓DOS能找到相關命令,就得須要作一下配置,首先咱們須要指定mysql服務啓動啓動的文件,用到bin包下的mysqld.exe命令,能夠經過環境變量配置找到此命令,也可經過在my-default.ini文件中添加下面配置的方式找到此命令:html
添加 WinMySQLAdminmysql
basedir:設置mysql的安裝目錄 sql
datadir:設置mysql數據庫的數據的存放目錄數據庫
port: 端口號ui
server_id: server-id值相似於IP地址server
# 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.
[WinMySQLAdmin]
# 指定mysql服務啓動啓動的文件
Server=E:/Software/mysql-5.6.24/bin/mysqld.exe htm[mysqld]utf-8
# 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 = 128Mrem# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_binit# These are commonly set, remove the # and set as required.
basedir = E:/Software/mysql-5.6.24
datadir = E:/Software/mysql-5.6.24/data
port = 3306
server_id = 101[client]
default-character-set=utf-8
# 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 = 2Msql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
2、修改爲功後 進入 Dos界面
運行mysqld -install 安裝mysql服務
mysql>mysqld -install
mysql>net start mysql 啓動mysql 服務
在mysql控制檯下以root用戶登陸,默認root用戶是沒有密碼的,直接按回車
mysql>mysql -u root -p
設置root密碼,直接在登陸狀態下設置
mysql>set password=password('你的密碼');
mysql>flush privileges;
退出,從新進入,這時密碼就已經生效了。
補充:
中止mysql的服務用net stop mysql
刪除mysql的服務用mysqld -remove