ubuntu下mysql的'Access denied for user 'root'@'localhost
2014-10-23 09:57
411 查看
问题现象:
我的环境是xubuntu 12.10下apt-get安装mysql,登陆无法登陆,报错信息这样描述:在用命令(sudo apt-get install mysql-server mysql-client)安装完.mysql服务即开始运行了.此时需要修改root密码,但经常会出现这么一种情况.'Access denied for user 'root'@'localhost' (using password: YES)' 或者其他致使无法登录mysql的情况。
解决方法:
1.打开/etc/mysql/debian.cnf文件,里面存储了相关的密码,我的文件信息如下
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 6x1XG2B5p75WtFV2
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = 6x1XG2B5p75WtFV2
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
在[client]段有user=以及password=这两行,这就是通过apt-get安装mysql,系统给我们设置的mysql登录名和密码
2. 输入命令:
debian-sys- maint即debian.cnf中user=后面的内容.回车后会提示输入密码,此时把password=后面的内容复制粘贴后回车即可进行mysql 控制台
3.进入控制台后.按以下步骤进行:
此时可以输入quit;退出后用root帐号登录,也可以继续其他操作.
我的环境是xubuntu 12.10下apt-get安装mysql,登陆无法登陆,报错信息这样描述:在用命令(sudo apt-get install mysql-server mysql-client)安装完.mysql服务即开始运行了.此时需要修改root密码,但经常会出现这么一种情况.'Access denied for user 'root'@'localhost' (using password: YES)' 或者其他致使无法登录mysql的情况。
解决方法:
1.打开/etc/mysql/debian.cnf文件,里面存储了相关的密码,我的文件信息如下
sudo vi /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 6x1XG2B5p75WtFV2
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = 6x1XG2B5p75WtFV2
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
在[client]段有user=以及password=这两行,这就是通过apt-get安装mysql,系统给我们设置的mysql登录名和密码
2. 输入命令:
mysql -udebian-sys-maint -p
debian-sys- maint即debian.cnf中user=后面的内容.回车后会提示输入密码,此时把password=后面的内容复制粘贴后回车即可进行mysql 控制台
3.进入控制台后.按以下步骤进行:
use mysql; update user set password=PASSWORD('新密码') where user='root'; FLUSH PRIVILEGES;
此时可以输入quit;退出后用root帐号登录,也可以继续其他操作.
相关文章推荐
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO))
- 如何面对ubuntu mysql ----->>> Access denied for user 'root'@'localhost'
- ubuntu mysql问题 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)解决
- [solved]access denied for user 'root'@'localhost' (using password no) ubuntu mysql
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:
- Ubuntu上使用jsp去连接mysql的时候踢提示Access denied for user 'root'@'localhost' (using password: YES)的解决办法!!!
- Ubuntu mysql 的Access denied for user 'root'@'localhost' (using password: YES错误解决方法
- mysql报ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password)错误或者远程用户不能登录
- 解决mysql“Access denied for user 'root'@'localhost'”
- JSP连接MySQL时错误:Access denied for user 'root'@'localhost' (using password: YES)'解决方案
- Toad for MySQL ,Navicat for MySQ连接错误 Access denied for user: 'root@localhost' (Using password: YES)
- 解决mysql“Access denied for user 'root'@'localhost'” ———— 转自UX博客
- Mysql 远程访问SQLSTATE[28000][1045] Access denied for user 'root'@'localhost'
- 解决mysql“Access denied for user 'root'@'localhost'”
- 解决mysql“Access denied for user ‘root’@'localhost’”
- windows系统下mysql出现Error 1045(28000) Access Denied for user 'root'@'localhost'
- 登录MySQL时遇到问题Access denied for user 'root'@'localhost'解决