Win7下安装Mysql方法
下载mysql安装包
进行配置
安装包名称:mysql-5.6.12-winx64.zip
解压安装包,记路径,我就直接放在桌面了,并且做了重命名
C:\Users\hy\Desktop\mysql
修改mysql目录下的配置文件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.
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
# 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 = C:\Users\hy\Desktop\mysql
datadir = C:\Users\hy\Desktop\mysql\data
# port = .....
# server_id = .....
# 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
以管理员身份启动cmd,切换到目录C:\Users\hy\Desktop\mysql\bin
安装mysql:mysqld.exe –install(CMD中执行后,如果报拒绝,则需要用管理员权限运行CMD,然后执行该命令)
往往都是权限不够导致的
以管理员身份运行的方式:找到运行程序cmd.exe,右键以管理员方式运行
C:\Windows\System32
启动MySQL
以管理员身份启动cmd,切换到目录D:/mysql-5.6.12-win32/bin
启动mysql服务:net start MySQL
(若想在cmd命令中直接运行指令,而不用进入bin目录下,需要在环境变量中增加路径,如图:
PS:系统默认的Mysql是自启动的,修改为手工启动的方法:
进入本机的“服务”,修改为手动启动即可,如图:
执行命令
登录mysql
mysql -u root -p
输入密码(密码为空,直接回车),即可登录。
修改root密码为123456:
mysql > set password = password('123.com');
mysql > flush privileges;
mysql > exit
停止mysql服务
net stop MySQL
卸载mysql服务
mysqld.exe --remove
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/101914.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...