• 【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>

    赠人玫瑰
    手留余香

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

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

  • 相关阅读:
    A*算法实现 八数码问题
    poj 1077 Eight(bfs,dbfs, A*)
    poj 1729 Jack and Jill (搜索,bfs)
    poj 4105 拯救公主(bfs)
    poj4091The Closest M Points(KD-tree)
    资源整理
    推荐 VS2010入门教程—鸡啄米
    Cstring的使用
    VC 中TEXT、_T、L的区别
    电脑内存和CPU的关系
  • 原文地址:https://www.cnblogs.com/haochuang/p/2478955.html
Copyright © 2020-2023  润新知