1
I am learning PHP with Lumen and came across a problem in the api connection string.
I have mysql installed and can use it normally via Workbench. When I click to see the connection information, an information appears that the Host name is INT-WKS10
. However, when I turn the command down:
select user,host from mysql.user
I get the result:
sa %
mysql.infoschema localhost
mysql.session localhost
mysql.sys localhost
root localhost
I have tried several settings. When I set up DB_HOST with localhost, I get the following error:
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL:
When I use the INT-WKS10, I get the error:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'INT-WKS10.integro.inf.br' (using password: YES)
Below my connection
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=agendamento
DB_USERNAME=root
DB_PASSWORD=123456
I believe your problem is to create a user with all the privileges in the bank, instead of using root.
– Glenys Mitchell
I did it and it didn’t work. Does it have to do with the type of authentication? The options are standard, SHA256 Password or caching_sha2_password.
– Ana Carol
The root user only has access via localhost, and you are apparently trying to access from another computer. You need to create a user who has permission like the user sa there, who has permission %-> any source
– Rafael Mena Barreto
I’m accessing the base on my local machine
– Ana Carol
But the bank is in your local machine?
– Glenys Mitchell
Got it! Thanks! I created a user similar to sa and put the standard connection type.
– Ana Carol
And yes. DB is local
– Ana Carol
I’ll write the answer, mark it as answered, okay? You did what I said, or what Rafael Mena said?
– Glenys Mitchell
INT-WKS10.integro.inf.br
is a hosting? If yes, you should have a dashboard and in that dashboard for mysql within the hosting it creates a user and password for you, which nay is the "root" ... If it is another pc on your network, then you have to talk to who installed mysql to see which user is used. PS: for most things "root" is an exaggeration, in common and even advanced applications we usually do not need "root" access, root is something only interesting to those who maintain in the general bank and have permission for it.– Guilherme Nascimento