标签:top conf require sed size ati net 启动服务 变量
为了便捷安装现在网上提供了许多的绿色版本MySQL安装包,下载后解压即可使用,但是MySQL 下载直接运行还是有一点小问题,需要把MYSQL 注册成为系统服务;
1.下载mysql绿色版本 例如:mysql-5.7.20-winx64;
2.修改数据库配置文件,j将my-default.in文件复制并命名为: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 = ..... #设置基目录
# datadir = ..... #设置数据目录
# port = ..... #设置MYSQL端口
# 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
3.执行mysqld –install mysqld --defaults-file="D:\Program Files\mysql\my.ini",注册服务名,在windows服务中注册mysqld服务;
4.创建mysql的数据目录,执行 mysqld --initialize 创建数据库初始化文件;
5.执行net start mysql启动服务,net stop mysql关闭服务;
6.初次登录时,我们无法获取到数据库的root密码,所以需要my.ini文件中添加skip-grant-tables跳过权限验证。
7.将MYSQL配置系统环境变量,便于我们以后的操作;
8.执行mysql 命令,直接进入mysql系统;
8.登录成功,设置root初始化密码:
use mysql; update user set password=password(‘123456‘) where user=‘root‘;
9.将my.ini中的skip-grant-tables去掉,重启服务。
10.命令行中链接数据库,修改数据库密码;
mysql -uroot -p set password=password(‘123456‘); -- 设置root密码
此时我们已经将绿色版本的MYSQL安装完成了,相比安装还是简单了许多,如果不熟悉配置文件,还是手动的一步一步的安装会更加靠谱。
标签:top conf require sed size ati net 启动服务 变量
原文地址:http://www.cnblogs.com/mengyu/p/7718433.html