【mysql不能登陆root】

mysql无法登陆root:

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

查了一下,删掉data文件夹下和数据库无关的文件,在my-default.ini中加上'skip-grant-tables'选项,跳过密码登陆依然失败,加tmpdir路径也不可以;

PS C:\Program Files\MySQL\MySQL Server 5.6\bin> mysqld --skip-grant-tables
2019-10-21 14:48:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-21 14:48:07 4416 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.6\data\DESKTOP-FVGQVE8.lower-test
2019-10-21 14:48:07 4416 [Warning] Can't create test file C:\Program Files\MySQL\MySQL Server 5.6\data\DESKTOP-FVGQVE8.lower-test
2019-10-21 14:48:07 4416 [Note] Plugin 'FEDERATED' is disabled.
2019-10-21 14:48:07 4416 [Note] InnoDB: The InnoDB memory heap is disabled
2019-10-21 14:48:07 4416 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-10-21 14:48:07 4416 [Note] InnoDB: Compressed tables use zlib 1.2.3
2019-10-21 14:48:07 4416 [Note] InnoDB: CPU does not support crc32 instructions
2019-10-21 14:48:07 4416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-10-21 14:48:07 4416 [Note] InnoDB: Completed initialization of buffer pool
2019-10-21 14:48:07 32d4  InnoDB: Operating system error number 5 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory. It may also be you have created a subdirectory
InnoDB: of the same name as a data file.
2019-10-21 14:48:07 32d4  InnoDB: File name .\ibdata1
2019-10-21 14:48:07 32d4  InnoDB: File operation call: 'create' returned OS error 105.
2019-10-21 14:48:07 32d4  InnoDB: Cannot continue operation.

这是配置文件:

[mysqld]

explicit_defaults_for_timestamp=true
tmpdir="C:/Program Files/MySQL Server 5.6/temp/"
skip-grant-tables

old_passwords=0
# 设置3306端口

port=3306

# 设置mysql的安装目录

basedir="C:/Program Files/MySQL/MySQL Server 5.6

"# 设置mysql数据库的数据的存放目录

datadir="C:/Program Files/MySQL/MySQL Server 5.6/data

"# 允许最大连接数

max_connections=200

# 允许连接失败的次数

max_connect_errors=10

# 服务端使用的字符集默认为UTF8

character-set-server=utf8

# 创建新表时将使用的默认存储引擎

default-storage-engine=MYISAM
# 默认使用“mysql_native_password”插件认证

#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集

default-character-set=utf8


# 设置mysql客户端连接服务端时默认使用的端口

port=3306

default-character-set=utf8
innodb_buffer_pool_size=32M


innodb_force_recovery = 1

请大神解答这是什么问题?

3个回答

你的密码是否正确,感觉是密码不正确

u012964064
hxqpython 密码是正确的
3 个月之前 回复

看你的报错提示,就是说,你在用root用户登录的时候,他去读取你data目录中的数据文件,但是不能正确的去访问。你可以确认下mysql配置文件中的data目录位置和你的真实位置是否一致,是否有访问权限。

u012964064
hxqpython data目录位置是正确的,访问权限怎么设置?今天登录发现又恢复正常了
3 个月之前 回复

我的也相同不能登录,是不是服务没有来呢。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问