今天在别人的服务器上登录mysql发现无法登陆(Mysql别人实现安装好的) 
密码和用户名都是正确的,但登录后报如下错误: 
ERROR 1045 (28000): Access denied for user ‘admin’@'localhost’ (using password: YES)

尝试了加入-h和-port也无法登陆,最后只能重新修改了。注--该方法也可以用于当忘记数据库密码时,找回数据库密码用

如下是我执行过程,完全执行后,可以顺利登录数据库:linux下的执行脚本:

    1. login as: root
    2. Access denied
    3. root@×××××××'s password:
    4. Last login: Tue Feb 21 03:56:49 2012 from 218.17.162.225
    5. [root@INOTRADE ~]# ps -A
    6. PID TTY          TIME CMD
    7. 1 ?        00:00:01 init
    8. 1117 ?        00:00:00 udevd
    9. 1394 ?        00:00:00 syslogd
    10. 1405 ?        00:00:00 sshd
    11. 1414 ?        00:00:00 xinetd
    12. 1427 ?        00:00:00 couriertcpd
    13. 1429 ?        00:00:00 courierlogger
    14. 1437 ?        00:00:00 couriertcpd
    15. 1439 ?        00:00:00 courierlogger
    16. 1445 ?        00:00:00 couriertcpd
    17. 1447 ?        00:00:00 courierlogger
    18. 1454 ?        00:00:00 couriertcpd
    19. 1456 ?        00:00:00 courierlogger
    20. 1466 ?        00:00:00 qmail-send
    21. 1468 ?        00:00:00 splogger
    22. 1469 ?        00:00:00 qmail-lspawn
    23. 1470 ?        00:00:00 qmail-rspawn
    24. 1471 ?        00:00:00 qmail-clean
    25. 1486 ?        00:00:00 httpd
    26. 1528 ?        00:00:00 named
    27. 1573 ?        00:00:00 mysqld_safe
    28. 1623 ?        00:00:00 mysqld
    29. 1629 ?        00:00:00 httpd
    30. 1655 ?        00:00:00 httpsd
    31. 1659 ?        00:00:00 httpsd
    32. 1674 ?        00:00:00 crond
    33. 1682 ?        00:00:00 saslauthd
    34. 1683 ?        00:00:00 saslauthd
    35. 1689 ?        00:00:00 sshd
    36. 1691 pts/0    00:00:00 bash
    37. 1718 pts/0    00:00:00 ps
    38. // 无法登陆,密码正确的,不知道为什么,原来数据库表的访问权限也已经设置了的
    39. [root@INOTRADE ~]# mysql -uroot -p
    40. Enter password:
    41. [root@INOTRADE ~]# ERROR 1045 (28000): Access denied for user ‘admin’@'localhost’ (using password: YES)
    42. [root@INOTRADE ~]# mysql -uroot -p****** -hlocalhost
    43. [root@INOTRADE ~]# ERROR 1045 (28000): Access denied for user ‘admin’@'localhost’ (using password: YES)
    44. // 执行脚本,更新mysql数据库的数据,如用户名密码
    45. [root@INOTRADE ~]# sudo /etc/init.d/mysqld stop
    46. Stopping MySQL:                                            [  OK  ]
    47. [root@INOTRADE ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    48. [1] 1759
    49. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    50. [root@INOTRADE ~]# Starting mysqld daemon with databases from /var/lib/mysql
    51. -- 这步可能不会自动执行,等待十几秒后就可以直接回车返回到命令行模式下,然后登录到mysql服务器
    52. [root@INOTRADE ~]#
    53. [root@INOTRADE ~]# mysql -u root mysql
    54. Reading table information for completion of table and column names
    55. You can turn off this feature to get a quicker startup with -A
    56. Welcome to the MySQL monitor.  Commands end with ; or \g.
    57. Your MySQL connection id is 1
    58. Server version: 5.0.77 Source distribution
    59. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    60. mysql> select  host, user from user;
    61. +-----------+------------------+
    62. | host      | user             |
    63. +-----------+------------------+
    64. | %         | admin            |
    65. | localhost | admin            |
    66. | localhost | horde            |
    67. | localhost | pma_OBBVuV2L3mjn |
    68. +-----------+------------------+
    69. 4 rows in set (0.00 sec)
    70. -- 因为我数据库中没有root,换为admin了
    71. mysql> UPDATE user SET Password=PASSWORD('******') where USER='admin';
    72. Query OK, 2 rows affected (0.02 sec)
    73. Rows matched: 2  Changed: 2  Warnings: 0
    74. mysql> FLUSH PRIVILEGES;
    75. Query OK, 0 rows affected (0.02 sec)
    76. mysql> quit;
    77. Bye
    78. [root@INOTRADE ~]# /etc/init.d/mysqld restart
    79. STOPPING server from pid file /var/run/mysqld/mysqld.pid
    80. 120221 05:08:02  mysqld ended
    81. Stopping MySQL:                                            [  OK  ]
    82. Starting MySQL:                                            [  OK  ]
    83. [1]+  Done                    mysqld_safe --user=mysql --skip-grant-tables --skip-networking
    84. // 至此, 重启后就可以正常登录了
    85. [root@INOTRADE ~]# mysql -uadmin -p******
    86. Welcome to the MySQL monitor.  Commands end with ; or \g.
    87. Your MySQL connection id is 3
    88. Server version: 5.0.77 Source distribution
    89. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    90. mysql> show databases;
    91. +-------------------------+
    92. | Database                |
    93. +-------------------------+
    94. | information_schema      |
    95. | *******                 |
    96. | horde                   |
    97. | mysql                   |
    98. +-------------------------+
    99. 7 rows in set (0.01 sec)
    100. mysql> use ********;
    101. Reading table information for completion of table and column names
    102. You can turn off this feature to get a quicker startup with -A
    103. Database changed
    104. mysql> show tables;
    105. +------------------------------+
    106. | Tables_in_CQT_AMS            |
    107. +------------------------------+
    108. | T_ALM_APPLICATION            |
    109. | *****************            |
    110. | T_SYS_ROLE                   |
    111. | T_SYS_USER_INFO              |
    112. | T_SYS_USER_ROLE              |
    113. +------------------------------+
    114. 22 rows in set (0.00 sec)
    115. mysql> quit
    116. Bye
    117. [root@INOTRADE ~]#

Linux 下,mysql数据库报无法登陆错误:ERROR 1045 (28000): Access denied for use的更多相关文章

  1. 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 都可以使用这个方法 ...

  2. 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 ...

  3. 【转载】重置密码解决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 ...

  4. 重置密码解决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 ...

  5. mysql无法远程连接问题(ERROR 1045 (28000): Access denied for user 'root')

    mysql版本 : 8.0.21 使用mysql 作为nextcloud的数据库.之前使用挺正常的,因为被黑客勒索过一次,重新启动了一个mysql的docker镜像. 结果数据库配置老是失败,next ...

  6. 在Linux下 MySQL错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法【很管用】

    一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...

  7. 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwor

    一般这个错误是由密码错误引起,解决的办法自然就是重置密码. 假设我们使用的是root账户. 1.重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: #vim /etc/my.cnf(注:wi ...

  8. 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 ...

  9. 解决mysql登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题

    问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...

随机推荐

  1. 导出excel乱码问题

    今天遇到一个问题,在用C#做导出excel的时候,出现excel乱码问题.百度了下. 发现问题如下: 非中文字符编码问题. 解决方法: 把输出的excel格式设置成UTF-8即可. 更改代码: Res ...

  2. jquery treeview

    jquery treeview 插件参数说明 treeview开源地址:https://github.com/jzaefferer/jquery-treeview 1.animated:String ...

  3. Hbase快速开始——shell操作

    一. 介绍 HBase是一个分布式的.面向列的开源数据库,源于google的一篇论文<bigtable:一个结构化数据的分布式存储系统>.HBase是Google Bigtable的开源实 ...

  4. [转]Oracle分页之三:利用PagerView来实现无刷新GridView

    本文转自:http://www.cnblogs.com/scy251147/archive/2011/04/16/2018355.html 接上面一节,上面还存在问题就是分页控件使用的仍然是服务器端控 ...

  5. CentOS 6.5部署安装Memcached

    1. Yum安装Memcache 查找memcached yum  search  memcached 该命令可以查询yum库中有关memcached的安装包信息,以下是搜寻结果截图: 安装 memc ...

  6. [麦先生]如何使用AJAX实现按需加载

    按需加载的优势:在实际调查中发现,很多的网民在游览网站时具有明确的指向性,往往在进入主页后直接搜索进入自己需要的商品列表内,如果在客户进入主页时将主页信息全部加载完毕后展示给顾客,会极大的浪费网站资源 ...

  7. FPGA 设计技巧

    1.  资源共享的应用限制在同一个module里 这样 综合工具才能最大限度地发挥其资源共 享综合作用 2.  尽可能将Critical path上所有相关逻辑放在同一个module里 这样 综合工具 ...

  8. 最小瓶颈路 Uva 534 Frogger

    说明:关于Uva的题目,可以在vjudge上做的,不用到Uva(那个极其慢的)网站去做. 最小瓶颈路:找u到v的一条路径满足最大边权值尽量小 先求最小生成树,然后u到v的路径在树上是唯一的,答案就是这 ...

  9. floyd算法 青云的机房组网方案(简单)

    青云的机房组网方案(简单) 青云现在要将 nn 个机房连成一个互相连通的网络.工程师小王设计出一个方案:通过在 nn 个机房之间铺设 n-1n−1 条双向的光纤,将所有的机房连接.可以假设数据在两个机 ...

  10. ZBrush中的纹理-水手该怎样进行绘制

    如下是一张使用ZBrush3D图形绘制软件绘制的栩栩如生的水手图片,那么有人要问了,如何创建水手渲染的皮肤纹理呢?接下来,小编将教大家学习如何创建皮肤颜色,顺便说一下,这里所选取的颜色仅仅是在ZBru ...