MySQL压缩包安装问题记录

刚好最近本地环境需要用到MySQL,所以就去安装了下。本文对安装的过程遇到的几个问题记录下。

 

1、[ERROR] --initialize specified but the data directory has files in it. Aborting.

1.1、当使用MySQL压缩安装,执行命令

mysqld  --initialize

报如下错误:

D:\Program Files\MySQL\mysql-5.7.29-winx64\bin>mysqld  --initialize
2020-03-30T09:23:40.737469Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-03-30T09:23:40.737528Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-03-30T09:23:40.737533Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2020-03-30T09:23:40.739795Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2020-03-30T09:23:40.740519Z 0 [ERROR] Aborting

1.2、原因是原先的data目录下已有数据,只要将data目录删除,然后重新运行命令即可。

运行成功如下:

D:\Program Files\MySQL\mysql-5.7.29-winx64\bin>mysqld  --initialize
D:\Program Files\MySQL\mysql-5.7.29-winx64\bin>

 

2、ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

D:\Program Files\MySQL\mysql-5.7.29-winx64\bin>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

2.1、打开MySQL目录下的my.ini文件(Linux环境在 /etc/my.cnf)。

2.2、在文件的[mysqld]后面最后添加一行“skip-grant-tables”,保存并关闭文件。

2.3、重启MySQL57和MySQL Router服务。

net stop mysql
net start mysql

2.4、进入mysql,修改初始密码

默认账户是root

登录命令: mysql -u root -p

要求输入时直接回车键

切换数据库命令:use mysql;

修改密码命令:update user set authentication_string=password('123456') where user='root' and Host = 'localhost';

刷新数据库命令:flush privileges;

退出命令:quit;

 

3、mysql数据库在Navicat Premium连接的时候出现1862错误

3.1、管理员权限运行命令:mysqladmin -uroot -p password

设置新的密码之后,问题解决。

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Halo 咯咯

有你的支持我会更加努力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值