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 ...
随机推荐
- 飘逸的python - 解决一个有限制的组合需求
假设有一个团队技能的需求. 这类技能是要集齐所有指定的人就能激活. 但是因为同一个人又2种身份存在,比如杨戬/神杨戬,于是便产生了组合. 这种组合跟普通组合不一样,普通组合可以随意组合.而这种组合是每 ...
- iOS新的旅程之Swift语言的学习
好久都没有来这个熟悉而又陌生的地方啦, 想想已经有两三个月了吧,不过我相信以后还是会经常来的啦,因为忙碌的学习已经过去啦,剩下的就是要好好的总结好好的复习了,好好的熟悉下我们之前学习的知识点,将他们有 ...
- Flashback Drop实例操作
1.Flashback DropFlashback Drop 是从Oracle 10g 开始出现的,用于恢复用户误删除的对象(包括表,索引等), 这个技术依赖于Tablespace Recycle B ...
- html_day1
第一天学习,了解到html的结构和语法. html的语法: 1.所有的html标签都要放在<>尖括号里. 2.标签不分大小写 建议小写 3.标签中的属性与标签名之间要有一个空格,如多个 ...
- MVC View基础(转)
View主要用于呈现数据.由于Controller和相关的Service已经处理完业务逻辑并将结果打包成model实体,View只需要怎么去获得model并将其转为Html 1选择需要渲染的视图 在上 ...
- JavaScript当中的eval函数
eval函数 eval函数接收一个由JavaScript语句组成的字符串,并且返回字符串中最后一条语句的返回值,如果最后一条语句没有返回值,那么eval函数返回undefined.如果传递给eval函 ...
- poj 3177
第一道双联通的题目,求加几条边让原图成一个双联通图,求出度数为1的双联通分量的个数+1/2. Low[u]为u或u的子树中能通过非父子边追溯到的最早的节点,即DFS序号最小的节点的序号 #includ ...
- php+mysql+pdo连接数据库
1.$pdo = new PDO("mysql:host=localhost;dbname=test","root","123456");/ ...
- XMLHttpRequest基础知识
XMLHttpRequest 发送请求的两个重要方法:open(method,url,async)——参数:请求方式.请求地址.请求同步/异步:send(string)——参数:使用POST方式时,填 ...
- 深入了解三种针对文件(JSON、XML与INI)的配置源
深入了解三种针对文件(JSON.XML与INI)的配置源 物理文件是我们最常用到的原始配置的载体,最佳的配置文件格式主要由三种,它们分别是JSON.XML和INI,对应的配置源类型分别是JsonCon ...