Home  >  Q&A  >  body text

centos mysql 数据库登录错误

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

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

天蓬老师天蓬老师2743 days ago728

reply all(3)I'll reply

  • 高洛峰

    高洛峰2017-04-17 13:14:57

    mysql -u root
    Just press enter without password

    reply
    0
  • 阿神

    阿神2017-04-17 13:14:57

    Enter the password (I encountered this before and didn’t study it carefully, but entering the password seems to solve the problem

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 13:14:57

    You can find out this kind of problem just by Baidu.
    But since I have answered it, I will explain it to you in detail.
    1. Check whether the database password is set;
    2. Have the password been changed since the database was started? If the password has been changed, flush privileges;
    3. How many MySQLs have been installed? Log in with the absolute path: /path/to/mysql/bin/mysql -u username -p and press Enter. If you set a password, enter the password and press Enter. If you do not set a password, just press Enter to log in.

    reply
    0
  • Cancelreply