安装mysql 5.7.16-win64 MySQL 1045登录失败 问题的解决

安装mysql 5.7.16-win64

MySQL 1045登录失败 问题的解决

    Mysql5.7.16-win64 下载的是Zip 版。解压至你的mysql 目录下。

配置my.ini 文件,可以在 my-default.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]

#skip-grant-tables

# 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:/phpPlatform/mysql

datadir = D:/phpPlatform/mysql/data

port = 3306

# 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

ql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

loose-default-character-set = utf8

character_set_server = utf8

[client]

loose-default-character-set = utf8

port = 3306

user=root

password=admin

 

注意:存盘时必须以ansi 格式存储。


Mysql 第一次启动

点击start》所有程序》附件》命令提示符,以右键点击,以管理员身份打开

将目录转至$mysql 安装目录\bin

输入mysqld -install       (如果不用管理员身份运行,将会因为权限不够而出现错 误:Install/Remove of the Service Denied!) 

安装成功

安装成功后就要启动服务了,

输入:net start mysql

服务启动成功!


注意:这个时候经常会出现错误2和错误1067

如果出现错误2 系统找不到文件,检查一下是否修改过配置文件或者是否进入在bin目录下操作,如果配置文件修改正确并且进入了bin文件夹,需要先删除mysql(输入 mysqld -remove)再重新安装(输入 mysqld -install);

如果出现错误1067,那就是配置文件修改错误,确认一下配置文件是否正确。


服务启动成功之后,就可以登录了


输入mysql -u root -p

password: 直接回车。(第一次登录没有密码,直接按回车过)

登录成功!


注意: 成功登录mysql后,必须需要修改root 密码!否则下次登录将出现1045错误吗!

密码修改不能用

1)mysql> UPDATE user SET password=PASSWORD(‘newpswd’)WHERE user=’root’          (修改密码)

password函数为MySQL内部函数,其中newpswd为修改后的新密码。

因为该版本user 表中没有password 字段。而是以authentication_string 替代

同时还需要注意该字段必须是要加密后才能存储。

密码修改也不能使用:

2)UPDATE user SET authentication_string=”newpswd” WHERE user=”root”;

使用该方法,将会引起      Error 1045错误


正确的修改密码的方法是使用:

Alter user “root”@localhost” identified by “newpassword”

这样就保证了以后以root及新密码能正常登录,而不会再出现error 1045提示

Good luck

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值