MySQL5.7 - 免安装版安装方法
mysql5.7 下载地址:http://dev.mysql.com/downloads/mysql/
初始化数据库
安装完之后 首先要执行初始化 打开命令窗口切换到mysql的bin目录下:
mysqld --initialize --explicit_defaults_for_timestamp
(或者或略密码登录方式初始化数据库 mysqld --initialize-insecure --user=mysql)
然后在日志文件中,会生成一个初始密码:

注册服务:
D:\MySQL Server 5.7\bin>.\mysqld --install mysql
回车执行,会提示创建成功,打开服务可以找到刚创建的mysql服务,启动服务。
用这个密码命令行登录后:
.\mysql.exe -h127.0.0.1 -P3306 -uroot -p
会提示修改密码:
You must reset your password using ALTER USER statement before executing this statement.
第一次安装登陆后只能使用 ALTER USER 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; //记得修改自己的账户 flush privileges; //修改成功后刷新权限 quit; //最后退出
设置密码永不过期
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
卸载服务:
D:\MySQL Server 5.7\bin>.\mysqld --remove mysql
也可以:sc delete 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] port = 3306 socket = 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 = ..... # 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 port = 3306 socket = MySQL key_buffer_size = 16K max_allowed_packet = 1M table_open_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 128K server-id = 1 character-set-server=utf8 default-storage-engine=INNODB innodb_lock_wait_timeout = 500 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash default-character-set = utf8 [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M [mysqlhotcopy] interactive-timeout
posted on 2016-08-01 09:23 TrustNature 阅读(22) 评论(0) 收藏 举报
浙公网安备 33010602011771号