MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
MySQL安装完server端和客户端后,登录Mysql时报错:
[root@rhel204 MySQL 5.6.23-RMP]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@rhel204 MySQL 5.6.23-RMP]# service mysql start
Starting MySQL.[ OK ]
[root@rhel204 MySQL 5.6.23-RMP for oraclelinux or rhel5-x86-64V74393-01]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
安装过程中并没有设置过任何密码,重装多次也是如此。。。。。
==========================
处理方法:
Reset Forgotten MySQL Root Password:
First things first. Log in as root and stop the mysql daemon.
sudo /etc/init.d/mysql stop
Now lets start up the mysql daemon and skip the grant tables which store the passwords.
sudo mysqld_safe --skip-grant-tables&
(press Ctrl+C now to disown the process and start typing commands again)
You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.
sudo mysql --user=root mysql
update user set password=password('new-password');
flush privileges;
exit;
Now kill your running mysqld then restart it normally.
sudo killall mysqld_safe&
(press Ctrl+C now to disown the process and start typing commands again)
/etc/init.d/mysql start
You should be good to go. Try not to forget your password again.
https://www.howtoforge.com/reset-forgotten-mysql-root-password
http://www.cnblogs.com/khler/archive/2011/02/10/1950819.html
[root@rhel201 mysql]# mysql -uroot -p --使用上面修改的新密码登录
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-enterprise-commercial-advanced 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
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> exit
Bye
需要重新修改密码:
[root@rhel201 mysql]# mysqladmin -uroot -p password rusky --将密码修改为rusky
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
[root@rhel201 mysql]# mysqladmin -uroot -p password rusky
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
[root@rhel201 mysql]# mysqladmin -uroot -p password rusky
Enter password:
Warning: Using a password on the command line interface can be insecure.
[root@rhel201 mysql]# mysql -uroot -p --使用新密码登录正常。
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial) 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
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
==========
问题补充:
-- :: [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
-- :: [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
A random root password has been set. You will find it in '/root/.mysql_secret'.
-- :: [Note] Binlog end
新版本的mysql安装过程中创建一个新的随机密码:
[root@rusky~]# cat .mysql_secret
# The random password set for the root user at Tue Apr 14 17:13:09 2015 (local time): VUbNaGLLtAU546Nh
登录命令:mysql -uroot -pVUbNaGLLtAU546Nh --使用文件中的随机密码可正常登录。
[root@NOP6-citrix01 local]# mysqladmin -uroot -p password --修改密码
Enter password: VUbNaGLLtAU546Nh
New password: 新密码
Confirm new password: 新密码
[root@NOP6-citrix01 local]#
MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO的更多相关文章
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因
在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...
- [mysql] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).
用mysql -u root -p显示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YE ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 的解决办法和原因
这两天下载了MySQL5.7.11进行安装,发现到了初次使用输入密码的时候,不管怎样都进不去,即使按照网上说的在mysqld 下面添加skip-grant-tables也是不行,后来研究了两天,终于找 ...
- Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...
- mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))
mysql链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)) 修改: # ...
- 安装mysql因为/tmp权限不足而导致ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)的解决方案
本机是centos 6.5 安装的mysql是5.1的版本. 在安装mysql之后,第一次启动mysql服务的时候,需要/tmp有777(rwxrwxrwx)的权限,然而楼主的/tmp是755(rw ...
- MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Enter password: E ...
- 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
出现报错: Warning: World-writable config file '/etc/my.cnf' is ignored // 该文件权限过高ERROR 1045 (28000): Acc ...
随机推荐
- Android应用程序的Activity启动过程简要介绍和学习计划
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6685853 在Android系统中,Activ ...
- IT定理:摩尔定理,安迪-比尔定理,反摩尔定理
前两天在网上不经意间搜到了一本吴军的<浪潮之巅>,讲的是现代国际上计算机界的各大公司的兴衰沉浮,包括AT&T公司与IBM等等,把它当作IT历史书看,到现在已经看了一部分了.其中,我 ...
- Android--------Java接口回调
>###回调说明 回调说明: 1.class A,class B 2.class A 实现接口callback 3.class B拥有一个参数为c ...
- NOT 运算符
NOT运算符不是独立的,它是一个可以放在任何逻辑表达式前面的修饰符,能得到与结果相反的结果.所以,如果一个表达式是真,就会得到假:如果是假,就会得到真.有时测试查找条件的反面更容易.不过,NOT运算符 ...
- libxml两种换行方法
好久没上来留下一些记录了,可能是太忙,又或者是过于慵懒便疏于整理. libxml是一个开源的库,linux下解析xml文件经常用到,进行一些创读增删的操作. 最开始接触的时候,看到了一个简明易懂的&l ...
- VB短信猫开发包,支持超长短信
一.短信猫开发包(长短信/异步调用)说明: 短信猫开发包以OCX控件的形式提供,支持Windows平台下常用的开发工具:如VB.VB.net.VC++.Power Builder.C#.DELPH ...
- javascirpt IP验证
js IP 端口验证 function isPort(str) { var parten=/^(\d)+$/g; if(parten.test(str)&&parseI ...
- UIScrollView 代理方法
在使用UIScrollView和它的子类UITableView时,有时需要在不同操作状态下,做不同的响应. 如何截获这些状态,如正在滚动,滚动停止等,使用UIScrollViewDelegate_Pr ...
- POJ 2135 Farm Tour (最小费用最大流模板)
题目大意: 给你一个n个农场,有m条道路,起点是1号农场,终点是n号农场,现在要求从1走到n,再从n走到1,要求不走重复路径,求最短路径长度. 算法讨论: 最小费用最大流.我们可以这样建模:既然要求不 ...
- [转载]启用 VIM 中的 Python 自动补全及提示功能
转载: http://zhongwei-leg.iteye.com/blog/941474 周围的同事不喜欢使用 VIM 写 Python 代码的原因之一就是,VIM 不能像 Visual Studi ...