1、解压mysql-5.6.14-winx64.zip到F:\Server重命名为mysql,将目录下的my-default.ini拷贝一个并且重命名为my.ini,修改内容如下:
# 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.
[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=F:\Server\mysql
datadir=F:\Server\mysql\data
port=3306
character-set-server=utf8
#CREATE TABLE 语句的默认表类型,如果不自己指定类型,则使用下行的类型
default-storage-engine = InnoDB
server-id = 1
# 最大连接数量
max_connections = 500
# 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
然后将F:\Server\mysql\bin配置到环境变量Path
在cmd中bin目录底下执行mysqld -install(将mysql安装为windows服务)
如果之前有安装过的mysql的,需要删除之前版本,则要进行以下操作,否则跳过
net sotp mysql//停止服务
mysqld -nt -remove//删除
sc delete mysql//从系统中删除服务名
同时,需要在注册表中删除
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL目录
以及它的兄弟.............\ControlSet002\....................................
.........................\CurrentControlSet\................................
卸载mysql
执行命令:net start mysql 或者windows管理工具->服务里面找到MySql服务,并启动
在命令行中运行mysql -u root 进入数据库。
修改密码
输入mysql回车
mysql> use mysql;
mysql> update user set password=password('123456') where user='root';
刷新权限
mysql> flush privileges;
mysql> \q;退出
!!注意:安装时,如果是WIN7系统,可能出现:Install/Remove of the Service Denied!今天在win7下安装 mysql 运行 mysqld -install 时,居然出现Install/Remove of the Service Denied!WINDOW 7 跟 vista 都有这问题。因为他们的权限更严格。
解决方法是:
进入 C:\Window 找到CMD.EXE 右键选择 以管理员身份 进行,再进入相应目录执行命令。
欢迎加入258154984群
258154984