一、mysql是通过DOS命令方式操作的,所以需要让DOS能找到相关命令,就得需要做一下配置,首先我们需要指定mysql服务启动启动的文件,用到bin包下的mysqld.exe命令,可以通过环境变量配置找到此命令,也可通过在my-default.ini文件中添加下面配置的方式找到此命令:
添加 WinMySQLAdmin
basedir:设置mysql的安装目录
datadir:设置mysql数据库的数据的存放目录
port: 端口号
server_id: server-id值类似于IP地址
# 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[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 = 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
二、修改成功后 进入 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