首先数据库的登录密码没有错误
在通过mysql命令登录本地的数据库时产生标题所示的错误。
>mysql -u root -p
./mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
设置由于设置了远程访问数据库造成的。解决方法:
# ./mysql -u root -h 127.0.0.1 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4660
Server version: 10.3.29-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
带上具体的IP地址。