Linux 下,mysql数据库报无法登陆错误:ERROR 1045 (28000): Access denied for use
今天在别人的服务器上登录mysql发现无法登陆(Mysql别人实现安装好的)
密码和用户名都是正确的,但登录后报如下错误:
ERROR 1045 (28000): Access denied for user ‘admin’@'localhost’ (using password: YES)
尝试了加入-h和-port也无法登陆,最后只能重新修改了。注--该方法也可以用于当忘记数据库密码时,找回数据库密码用
如下是我执行过程,完全执行后,可以顺利登录数据库:linux下的执行脚本:
- login as: root
- Access denied
- root@×××××××'s password:
- Last login: Tue Feb 21 03:56:49 2012 from 218.17.162.225
- [root@INOTRADE ~]# ps -A
- PID TTY TIME CMD
- 1 ? 00:00:01 init
- 1117 ? 00:00:00 udevd
- 1394 ? 00:00:00 syslogd
- 1405 ? 00:00:00 sshd
- 1414 ? 00:00:00 xinetd
- 1427 ? 00:00:00 couriertcpd
- 1429 ? 00:00:00 courierlogger
- 1437 ? 00:00:00 couriertcpd
- 1439 ? 00:00:00 courierlogger
- 1445 ? 00:00:00 couriertcpd
- 1447 ? 00:00:00 courierlogger
- 1454 ? 00:00:00 couriertcpd
- 1456 ? 00:00:00 courierlogger
- 1466 ? 00:00:00 qmail-send
- 1468 ? 00:00:00 splogger
- 1469 ? 00:00:00 qmail-lspawn
- 1470 ? 00:00:00 qmail-rspawn
- 1471 ? 00:00:00 qmail-clean
- 1486 ? 00:00:00 httpd
- 1528 ? 00:00:00 named
- 1573 ? 00:00:00 mysqld_safe
- 1623 ? 00:00:00 mysqld
- 1629 ? 00:00:00 httpd
- 1655 ? 00:00:00 httpsd
- 1659 ? 00:00:00 httpsd
- 1674 ? 00:00:00 crond
- 1682 ? 00:00:00 saslauthd
- 1683 ? 00:00:00 saslauthd
- 1689 ? 00:00:00 sshd
- 1691 pts/0 00:00:00 bash
- 1718 pts/0 00:00:00 ps
- // 无法登陆,密码正确的,不知道为什么,原来数据库表的访问权限也已经设置了的
- [root@INOTRADE ~]# mysql -uroot -p
- Enter password:
- [root@INOTRADE ~]# ERROR 1045 (28000): Access denied for user ‘admin’@'localhost’ (using password: YES)
- [root@INOTRADE ~]# mysql -uroot -p****** -hlocalhost
- [root@INOTRADE ~]# ERROR 1045 (28000): Access denied for user ‘admin’@'localhost’ (using password: YES)
- // 执行脚本,更新mysql数据库的数据,如用户名密码
- [root@INOTRADE ~]# sudo /etc/init.d/mysqld stop
- Stopping MySQL: [ OK ]
- [root@INOTRADE ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
- [1] 1759
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
- [root@INOTRADE ~]# Starting mysqld daemon with databases from /var/lib/mysql
- -- 这步可能不会自动执行,等待十几秒后就可以直接回车返回到命令行模式下,然后登录到mysql服务器
- [root@INOTRADE ~]#
- [root@INOTRADE ~]# mysql -u root 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. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.0.77 Source distribution
- Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- mysql> select host, user from user;
- +-----------+------------------+
- | host | user |
- +-----------+------------------+
- | % | admin |
- | localhost | admin |
- | localhost | horde |
- | localhost | pma_OBBVuV2L3mjn |
- +-----------+------------------+
- 4 rows in set (0.00 sec)
- -- 因为我数据库中没有root,换为admin了
- mysql> UPDATE user SET Password=PASSWORD('******') where USER='admin';
- Query OK, 2 rows affected (0.02 sec)
- Rows matched: 2 Changed: 2 Warnings: 0
- mysql> FLUSH PRIVILEGES;
- Query OK, 0 rows affected (0.02 sec)
- mysql> quit;
- Bye
- [root@INOTRADE ~]# /etc/init.d/mysqld restart
- STOPPING server from pid file /var/run/mysqld/mysqld.pid
- 120221 05:08:02 mysqld ended
- Stopping MySQL: [ OK ]
- Starting MySQL: [ OK ]
- [1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
- // 至此, 重启后就可以正常登录了
- [root@INOTRADE ~]# mysql -uadmin -p******
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 3
- Server version: 5.0.77 Source distribution
- Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- mysql> show databases;
- +-------------------------+
- | Database |
- +-------------------------+
- | information_schema |
- | ******* |
- | horde |
- | mysql |
- +-------------------------+
- 7 rows in set (0.01 sec)
- mysql> use ********;
- Reading table information for completion of table and column names
- You can turn off this feature to get a quicker startup with -A
- Database changed
- mysql> show tables;
- +------------------------------+
- | Tables_in_CQT_AMS |
- +------------------------------+
- | T_ALM_APPLICATION |
- | ***************** |
- | T_SYS_ROLE |
- | T_SYS_USER_INFO |
- | T_SYS_USER_ROLE |
- +------------------------------+
- 22 rows in set (0.00 sec)
- mysql> quit
- Bye
- [root@INOTRADE ~]#
Linux 下,mysql数据库报无法登陆错误:ERROR 1045 (28000): Access denied for use的更多相关文章
- Win7下mysql root账户登录提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)解决方案
ERROR 1045 (28000): Ac-- password: YES)这个意思是密码不正确,那就修改密码: 如果你是服务器是 windows xp/2000/2003/nt 都可以使用这个方法 ...
- mac系统中搭建apache+mysql+php的开发环境,安装mysql后,登录报错:mac ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
php新手在mac系统中搭建apache+mysql+php的开发环境(按照这篇博客来操作的:http://my.oschina.net/joanfen/blog/171109?fromerr=xvC ...
- 【转载】重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor ...
- 重置密码解决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 ...
- mysql无法远程连接问题(ERROR 1045 (28000): Access denied for user 'root')
mysql版本 : 8.0.21 使用mysql 作为nextcloud的数据库.之前使用挺正常的,因为被黑客勒索过一次,重新启动了一个mysql的docker镜像. 结果数据库配置老是失败,next ...
- 在Linux下 MySQL错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法【很管用】
一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...
- 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor
一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...
- 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)问题
问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...
随机推荐
- 2013年 蓝桥杯预赛 java 本科A 题目
1.标题: 世纪末的星期 曾有邪教称1999年12月31日是世界末日.当然该谣言已经不攻自破. 还有人称今后的某个世纪末的12月31日,如果是星期一则会.... 有趣的是,任何一个世纪末的年份的12月 ...
- PHP实战-文章发布系统学习记录
跟随大师的步伐,一步一步向前行进,PHP学习之路中的历程. 如果图片不能正常查看请访问云笔记链接 http://note.youdao.com/share/?id=3c25d8c03ef946d9c6 ...
- Error: Could not access the Package Manager. Is the system running?
最近在搭建cordova,android 开发环境,安装android studio之后创建一个demo之后,运行想看一下效果,在运行过程中创建一个虚拟机(arm)的,等了有1分钟左右,再次运行程序, ...
- beeline vs hive cli
近期,大数据开发环境升级为cloudera 5.3. 配套的hive版本升级为0.13.1.可以使用心仪已久的分析开窗函数了.但在使用的过程中发现一些问题,仅记于此. 1.在使用hive命令的时候,发 ...
- 电磁兼容设计经验(转载 原文电子科技大学硕士毕业论文DDS扩频技术研究)
2 Corinthians 1:3-4“[Praise to the God of All Comfort] Praise be to the God and Father of our Lord J ...
- leetcode-Single Number III 找独数
Single Number III Given an array of numbers nums, in which exactly two elements appear only once and ...
- POJ 3225 Help with Intervals --线段树区间操作
题意:给你一些区间操作,让你输出最后得出的区间. 解法:区间操作的经典题,借鉴了网上的倍增算法,每次将区间乘以2,然后根据区间开闭情况做微调,这样可以有效处理开闭区间问题. 线段树维护两个值: cov ...
- AC日记——产生数 codevs 1009 (弗洛伊德)(组合数学)
1009 产生数 2002年NOIP全国联赛普及组 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 查看运行结果 题目描述 Descriptio ...
- java 14-11 对象数组
有5个学生,请把这个5个学生的信息存储到数组中,并遍历数组,获取得到每一个学生信息. 创建学生类: 学生:Student 成员变量:name,age 构造方法:无参,带参 成员方法:getXxx()/ ...
- 用CSS3实现上下左右箭头
225deg 向上箭头 135deg向下箭头45deg向右箭头 -45deg向左箭头