MYSQL登录错误:mysqladmin: connect to server at ‘localhost’ failed
一、mysql登录错误
mysqladmin: connect to server at ‘localhost’ failed error: ‘Access denied for user
‘root’@’localhost’ (using password: YES)’
解决办法:破解mysql密码
service mysqld stop
#>mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
>use mysql;
> update user set password=PASSWORD("123456")where user="root";
更改密码为 newpassord
> flush privileges; 更新权限
> quit 退出
service mysqld restart
mysql -uroot -p新密码进入
二,忘记本地root的登录密码
解决过程:
1、编辑/etc/my.cnf
在[mysqld] 配置部分添加一行
skip-grant-tables
2、保存后重启mysql
[root@localhost etc]# service mysqld restart
Shutting down MySQL. [ OK ]
Starting MySQL. [ OK ]
3
3、登录数据库重新设置root密码
[root@localhost ~]# mysql -uroot -p root123
Enter password:
直接回车进入
mysql 配置文件目录:/etc/my.cnf
root 密码为空的时候配置文件中下面这句:
skip-grant-tables
GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION;
执行这句时候错误:
ERROR 1290 (HY000): The MySQL server is running with the