Mysql 5.7.17 windows安装

本文提供了一份详细的 MySQL 5.7 版本的安装及配置步骤,包括 my.ini 配置文件的调整建议,解决安装过程中可能出现的问题如初始化数据库和设置 root 用户密码等。

 

 

 

  1. 下载
  2. my.ini配置
    [mysql]
    default-character-set=utf8 
    [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:\work\DB\mysql-5.7.17-winx64
    datadir = D:\work\DB\mysql-5.7.17-winx64\data
    port = 3306
    # server_id = .....
    character-set-server=utf8
    default-storage-engine=INNODB
    
    
    # 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. 安装-启动

141243_63iq_231155.png

呵呵居然“没报任何错误”。(NET HELPMSG 3534)

查阅信息居然从5.7.6以后需要执行mysqld --initialize

3.1 执行mysqld -remove命令将以前的错误安装删除,否则会提示已经安装

141711_RCZp_231155.png

3.2 执行mysqld --initialize

141731_pVkb_231155.png

看error日志说data目录有东西了,清除data中的文件即可

3.3mysqld -install  然后 net start mysql启动服务

141844_IhOX_231155.png

3.4mysql -uroot -p   意料之中的出现下面的提示

142043_Cvir_231155.png

(Ps:在data目录下找一下安装日志ZB-PF0PP2TP.err,一般能找到临时密码,别忘了更改它。)

163646_EhCT_231155.png

找不到的 如下方式解决( mysqladmin -u root password 密码    设置初始密码的方式没起效!!!)

mysqld --skip-grant-tables #skip-grant-tables的意思是启动MySQL服务的时候跳过权限表认证。 

完事,可能需要你重新打开一个cmd窗口

mysql #进入mysql后
mysql> use mysql   #Database changed
mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';      #在之前的版本中,密码字段的字段名是 password,5.7版本改为了 authentication_string
mysql> flush privileges;   #更新权限
mysql> quit

找到mysqld的进程kill掉或者注销系统重启

在进入mysql会提示让你重置密码(不知道为啥还让修改,推测上一步绕开权限检测)

143902_CgGY_231155.png

mysql> set password for root@localhost = password('root'); 
mysql> flush privileges;   #更新权限

 

转载于:https://my.oschina.net/yuzn/blog/835540

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值