ITPub博客

首页 > 数据库 > MySQL > win7下安装mysql5.7.16

win7下安装mysql5.7.16

原创 MySQL 作者:water_chou 时间:2016-11-28 14:05:29 0 删除 编辑
1: 下载安装包,解压,添加mysql的bin路径到全局系统变量path中。
2:编辑my.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. [client] default-character-set=utf8 [mysqld] port=3306 basedir ="D:\mysql-5.7.16-winx64/" datadir ="D:\mysql-5.7.16-winx64/data/" tmpdir ="D:\mysql-5.7.16-winx64/data/" socket ="D:\mysql-5.7.16-winx64/data/mysql.sock" log-error="D:\mysql-5.7.16-winx64/data/mysql_error.log" #server_id = 2 #skip-locking max_connections=100 table_open_cache=256 query_cache_size=1M tmp_table_size=32M thread_cache_size=8 innodb_data_home_dir="D:\mysql-5.7.16-winx64/data/" innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128M innodb_buffer_pool_size=128M innodb_log_file_size=10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M read_rnd_buffer_size = 32M max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES ####################配置文件结束################### 3: 管理员cmd ,执行 mysqld install MySQL --defaults-file="D:\mysql-5.7.16-winx64\my.ini" --自己的my.ini路径
4:在命令行启动mysql命令为: net start mysql


如果启动失败,重新执行如下命令:
1: 管理员cmd, 输入mysqld --initialize 等待一段时间(这段时间就是在创建data文件夹),然后就再次输入net start mysql便可。

补充:
安装完之后登录mysql ,发现没有root密码。
于是net stop mysql,
编辑my.ini,添加一行 :skip-grant-tables。
重启net start mysql ,此时不需要密码就可以登陆 mysql -u root -p
然后修改mysql的root密码
>use mysql
>update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost'; --5.7版本中没有password这个字段了,很多资料都不适用。
>flush privileges;
>quit;
stop mysql服务 :net stop mysql;
注销掉my.ini文件中skip-grant-tables。
启动mysql: net start mysql;
登录mysql  mysql -u root -p
此时提示还需要执行alter 命令,
>alter user 'root'@'localhost' identified by '123';
到此才ok了。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24349972/viewspace-2129213/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Kevin Mitnick(一)
请登录后发表评论 登录
全部评论
上善若水

注册时间:2011-08-10

  • 博文量
    51
  • 访问量
    75752