MySQL-5.7.11绿色版安装

我的解压缩后目录地址是D:\Program Files\mysql-5.7.11-winx64\,可将此地址替换为你的版本。

1、解压缩后将配置文件my-default.ini复制一份为my.ini,其中内容改为

# 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.

[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 = "D:\Program Files\mysql-5.7.11-winx64"
 datadir = "D:\Program Files\mysql-5.7.11-winx64\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 

2、安装MySQL服务
开始-运行-cmd,cd到mysql安装目录的bin下面,执行“mysqld --install”命令,如果出现 “Install/Remove of the Service Denied! ”错误是权限问题。切换为管理员启动cmd命令,再输入“mysqld --install”,运行成功。



3、启动MySQL服务
直接在cmd中输入命令 “net start mysql”

如果出现“MySQL 服务无法启动”错误,这是5.6.*版本和5.7.*版本的区别 5.6.*版本中相应目录下有*\data文件夹,而5.7.*版本中没有

所以需要输入命令,是用于初始化数据的,初始完后就有data文件夹了。
“mysqld --initialize”这样会生成一个随机的root密码在data文件夹下*.err文件,[Note] A temporary password is generated for root@localhost: 6mQoY:+olm_/
或者  “mysqld  --initialize-inscure” (不设置root密码,建议使用)

如果错误“[ERROR] --initialize specified but the data directory has files in it. Aborting.”将目录底下的data文件夹删除即可。

再输入命令 “net start mysql”,就可以起动。

4、登录维护MySQL
第一次登陆输入命令 “mysql -u root -p",如果要输入密码即上面随机生成的密码“6mQoY:+olm_/”
登录成功为

退出命令exit;
注意有分号。

5、修改密码
回到bin目录下,输入命令“mysqladmin -u root -p password NewPassword”
上面的“NewPassword”是你要输入的新密码,然后跳出Enter password:之后输入原来随机的密码。
修改密码就成功了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值