mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
无法修改密码
用 service mysqld stop
mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
>use mysq;
> update user set password=PASSWORD('newpass')where user='root'; 更改密码为 newpass
> flush privileges; 更新权限
> quit 退出
service mysqld restart
mysql -uroot -p新密码进入
/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
权限问题
[root@localhost mysql]# chown -R mysql:root .
修改mysql用户权限,及授权外部连接
//修改用户表的方式,允许外部连接
use mysql;
update user set host='%' where host ='127.0.0.1';
flush privileges;
授权用户,当用户不存在时为创建用户,当用户存在时为修改权限或密码
//授权test用户对所有数据库具有所有权限,并无连接限制,密码为123456
grant all on *.* to "test"@"%" identified by "123456";
本文介绍了解决MySQL登录失败及权限问题的方法,包括重置root密码、设置MySQL用户允许远程连接、授权用户等步骤。
8416

被折叠的 条评论
为什么被折叠?



