• 【QA5】【mysql问题】ERROR 1045 (28000): Access denied for...


    问题现象:

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    原因分析:由于密码错误等原因导致连接失败。

    解决办法:修改用户名对应密码

    root@hao-ubuntu:/usr/local/autotest# /etc/init.d/mysql stop
    root@hao-ubuntu:/usr/local/autotest# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    [1] 1828
    root@hao-ubuntu:/usr/local/autotest# 120502 13:59:51 mysqld_safe Logging to syslog.
    120502 13:59:52 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    mysql -uroot 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.1.62-0ubuntu0.11.04.1 (Ubuntu)

    Copyright (c) 2000, 2011, 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> update user set password=PASSWORD('root') where USER='root';
    Query OK, 3 rows affected (0.00 sec)
    Rows matched: 3  Changed: 3  Warnings: 0

    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)

    mysql> quit
    Bye
    root@hao-ubuntu:/usr/local/autotest# /etc/init.d/mysql restart
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql restart

    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the stop(8) and then start(8) utilities,
    e.g. stop mysql ; start mysql. The restart(8) utility is also available.
    mysql start/running, process 1979
    root@hao-ubuntu:/usr/local/autotest# mysql -uroot -proot
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 35
    Server version: 5.1.62-0ubuntu0.11.04.1 (Ubuntu)

    Copyright (c) 2000, 2011, 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>

    赠人玫瑰
    手留余香

    我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的推荐按钮。
    如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的关注我

  • 相关阅读:
    PyQt5基础应用一
    常用SQL
    常用vim命令
    原生Ajax XMLHttpRequest对象
    跨域两种解决方案CORS以及JSONP
    Django生命周期 URL ----> CBV 源码解析-------------- 及rest_framework APIView 源码流程解析
    Django缓存机制--rest_framework中节流源码使用的就是django提供的缓存api
    Django2.0 models中的on_delete参数
    【开发工具IDE】Eclipse 安装 Maven 的 m2eclipse 插件
    【Java】CSVUtils
  • 原文地址:https://www.cnblogs.com/haochuang/p/2478955.html
Copyright © 2020-2023  润新知