mysql-5.7.10-winx64 绿色版安装办法
为了防止安装程序造成电脑系统冗余,经过测试,终于将绿色版的mysql for windows安装成功。当然很多是从事百度搜索到的,但作为一种积累将其记录在这里供各位学习,避免走弯路!
1.绿色版mysql文件下载:
2.将下载的文件解压放在自己指定的位置
3.设置环境变量
按照上面的方法设置环境变量,这样就可以在cmd终端直接访问D:\Program Files\mysql-5.7.10-winx64\bin下面的所有命令,红色框出来的命令为常用两个命令
4.设置mysql的配置文件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 = mysql-bin # These are commonly set, remove the # and set as required. character-set-server=utf8 collation-server=utf8_general_ci basedir = D:\Program Files\mysql-5.7.10-winx64\bin #安装路径 datadir = D:\Program Files\mysql-5.7.10-winx64\data #数据存放路径 port = 3306 #监听端口 socket = D:\Program Files\mysql-5.7.10-winx64\data\mysql.sock #sock存放路径 server_id = 1 # 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
5.mysql启动
// 这条命令如果不输,也能安装成功,但是启动的时候就会报错说:服务无法启动 服务没有报告任何错误解决办法 // 这条命令之前确保data文件夹内容为空 // 文档表明,使用-initialize生成随机密码,由于自己学习,使用-initialize-insecure生成空密码。默认帐号root,后面的-user=mysql不更改 mysqld --initialize-insecure --user=mysql// 安装服务 mysqld install // 启动服务 net start mysql
// 关闭服务
net stop mysql
6.客户端连接
cmd> mysql -uroot -p Enter password:<输入密码,默认为空>
原文:http://www.cnblogs.com/songqingbo/p/5080847.html