mysql 连续出现Connect Access denied for user root''@'localhost' (using password: NO)是怎么回

MySQL登录错误 Access denied for user解决方法-mysql教程-数据库-壹聚教程网MySQL登录错误 Access denied for user解决方法
看到错误提醒Access denied for user我们要么是mysql密码输入错误,要么就是你的mysql密码给人修改了或删除了,下面我来给各位介绍解决方法。
测试例子,我在中登录我本地的mysql,默认用户名密码为root,root但我尝试输入root,密码为www.111cn.net出现如下错误提醒.
如下图所示提醒:#1045 无法登录 MySQL 服务器
好我现在再使用mysqladmin来连接mysql同样输入错误密码
mysqladmin: connect to server at 'localhost' failed
error: ' denied for user 'root'@'localhost' (using pass: YES)'
这样的话都是密码与用户名不对的原因了,我们只要输入正常的用户名密码即可登录了,如果你有服务器管理权限,而你又不记得密码了我们可以尝试破解哦,提供一个windows破解mysql密码的例子。
&service mysqld stop
&mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
& update user set password=PASSWORD(&www.111cn.net&)where user=&root&; #更改密码为 newpass
& #更新权限 & quit #退出
&service mysqld restart
&mysql -uroot -pnewpass #新密码进入
这样你的新密码就是了我们再尝试登录就会提醒登录成功了。
上一页: &&&&&下一页:相关内容MYSQL问题解决方案:Access denied for user 'root'@'localhost&#
MYSQL问题解决方案:Access denied for user 'root'@'localhost&#,有需要的朋友可以参考下。 这两天在MyEclipse中开发Web项目时,连接MYSQL数据库,出现问题:Access denied for user 'root'@'localhost' (using password:YES)。 经查找资料发现是root帐户默认不开放远程访问权限,所以需要修改一下相关权限。 解决方案:打开MySQL目录下的my.ini文件,在文件的最后添加一行“skip-grant-tables”,保存并关闭文件。(WIN7默认安装,my.ini在C:/ProgramData/MySQL/MySQL Server 5.6)重启MySQL服务。通过命令行进入MySQL的BIN目录,输入“mysql -u root -p”(不输入密码),回车即可进入数据库。(WIN7默认安装,BIN目录为:C:/Program Files/MySQL/MySQL Server 5.6/bin)执行“”,使用mysql数据库。执行“update user set password=PASSWORD(&123456&) where user='root';”(修改root的密码)打开MySQL目录下的my.ini文件,删除最后一行的“skip-grant-tables”,保存并关闭文件。重启MySQL服务。在命令行中输入“mysql -u root -p 123456”,即可成功连接数据库。 完成以上步骤,MyEclipse也可成功连接MySQL了。 版权声明:本文为博主原创文章,未经博主允许不得转载。
最新教程周点击榜
微信扫一扫mysqlAccessdeniedforuser\'root\'@\'localhost\系列问题的解决方法
今天登录一台服务器,输入mysql -u root -p 回车后,报错,错误消息如下:
ERROR ): Access denied for user 'root'@'localhost' (using password: YES)
我按照网上修改密码的方法进行操作,没有解决问题。
我又这样输入命令:mysql -u root -p -h 127.0.0.1, 结果成功了,怀疑是主机权限问题
输入下面的命令, 不限制登录的主机,这样mysql -u root -p 就可以了
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'mysql Access denied for user ‘root’@’localhost’ (using password: YES)解决方法
投稿:junjie
字体:[ ] 类型:转载 时间:
这篇文章主要介绍了mysql Access denied for user ‘root’@’localhost’ (using password: YES)解决方法,本文给出详细的解决步骤及操作注释,需要的朋友可以参考下
今天在启动mysql时出现以下问题:
[root@www ~]# mysql -u root -p
Enter password:
ERROR ): Access denied for user 'root'@'localhost' (using password: YES)
网上的答案是各种各样的,最终解决问题的方法总结为以下,好多都是没有设置初始密码造成此问题的。
解决方法如下:
[root@www ~]# service mysqld stop
#先关闭mysql服务
Stopping mysqld:
[root@www ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@www ~]# mysql -u root -p
#关闭服务后又出现如下问题
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@www ~]# mysql -u root mysql
#键入此命令进入mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. C or \g.
Your MySQL connection id is 1
Server version: 5.1.73 Source distribution
Copyright (c) , Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type '' or '\h' for help. Type '\c' to clear the current input statement.
mysql& update user set password=password('123') where user='root' and host='localhost';
----&修改root的密码
Query OK, 1 row affected (0.04 sec)
Rows matched: 1 Changed: 1 Warnings: 0
ERROR ): You have an error in your SQL check the manual that corresponds to your MySQL server version for the right syntax to use near 'priviledge' at line 1
Query OK, 0 rows affected (0.00 sec)
[root@www ~]# mysql -u root -p
------&重新进入
Enter password:
Welcome to the MySQL monitor. C or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) , Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type '' or '\h' for help. Type '\c' to clear the current input statement.
到此就完了!!
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具解决mysql“Access&denied&for&user&root@localhost”
来源:/article/8/2007/linux_936.html
我的系统是ubuntu6.06,最近新装好的mysql在进入mysql工具时,总是有错误提示:
# mysql -uroot -p
Enter password:
ERROR ): Access denied for user 'root'@'localhost'
(using password: NO)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password:
现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking
# mysql -u root mysql
mysql& UPDATE user SET
Password=PASSWORD('newpassword') where USER='root';
mysql& FLUSH PRIVILEGES;
mysql& quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password:
&输入新设的密码newpassword&
直接使用/etc/f文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password:
&输入[client]节的密码&
mysql& UPDATE user SET
Password=PASSWORD('newpassword') where USER='root';
mysql& FLUSH PRIVILEGES;
mysql& quit
# mysql -uroot -p
Enter password:
&输入新设的密码newpassword&
这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!
# mysql -uroot -p
Enter password:
&输入/etc/f文件中[client]节提供的密码&
至此,困惑多时的问题解决了!
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 mysql grant for user 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信