The browser reported an error Access denied for user 'root'@'localhost' (using password:NO

browser error: SQLSTATE [HY000] [1045] Access denied for user "root"@"localhost" (using password: NO)
I successfully connected to the database with navicat, the user name is root, password is the password set when installing mysql, and the framework uses tp5,
to find many methods that do not work. How to solve it?

Mar.01,2021

method link seen when encountered earlier: https://bbs.csdn.net/topics/3.


simply understand the meaning of MySQL-Server connections.
from a beginner's point of view, there are two ways to connect MySQL-Server :

1.  Navicat 
2. API  ``

look at your problem, it is very likely that users like root@192.168.%.% set passwords, while root@localhost do not.

 MySQL 

$ mysql -uroot -hlocalhost -p
 -p  Linux 

 mysql 
$ sudo yum -y install mysql

$ sudo apt-get install mysql
 mysql 

 Navicat  root@localhost 
$ SELECT User, Host, Password FROM mysql.user;

by the way, your question is very common, it is not recommended that you ask it directly, it is better to search directly.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e873db-46bf8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e873db-46bf8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?