用户"root" Laravel的访问被拒绝 [英] Access denied for user 'root' Laravel

查看:348
本文介绍了用户"root" Laravel的访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在线运行项目(从本地移动到主机),但出现此错误:

I try to run my project online (move from local to host) but i get this error:

SQLSTATE[HY000] [1045] ProxySQL Error: Access denied for user 'root'@'2a02:4780:bad:f00d::8' (using password: NO) (SQL: select count(*) as aggregate from `posts`)

这是我的.env文件:

APP_NAME=TJD
APP_ENV=local
APP_KEY=base64:7tnIYoBvOfhfNXGSucngHdi2EMSMau3f9YTnQsrqgRE=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=https://tjd.000webhostapp.com/

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=ixxxxx23_xxxxxx
DB_USERNAME=idxxxxxx_xxd
DB_PASSWORD=xxxxxxxxxxxxxxxx

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=


TELEGRAM_BOT_TOKEN=

TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_SECRET=

FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
CALLBACK_URL_FACEBOOK=

出了什么问题?为什么我会收到此错误?

What is the issue? why do i get this error?

............................................... .....................

....................................................................

推荐答案

我也遇到了相同的错误,解决该问题花费的时间比我想要的要长,所以我要发布解决方案以节省某人的时间.我在000webhost.com上免费托管了laravel 5.3网站.我认为当您的登录凭据错误时会出现此错误.这是我的.env文件中的MYSQL连接详细信息.

I also got the same error and it took me longer to solve it than i would have wanted, so i'm posting the solution i got to save someone's time. Im hosting my laravel 5.3 site on free webhosting at 000webhost.com. This error shows up i think when your login credentials are wrong. Here is my MYSQL connection details in my .env file.

`DB_CONNECTION=mysql
 DB_HOST=localhost
 DB_PORT=3306
 DB_DATABASE=id1767899_keen
 DB_USERNAME=id1767899_root
 DB_PASSWORD=rootadmin`

以前,我在数据库名称和用户名上没有id1767899_前缀.您可以在管理数据库链接上获得此前缀,该链接上有一个用于管理数据库的按钮.添加此前缀后,您将得到一个新错误,例如Wrong COM_STMT_PREPARE response size. Received 7.要解决此错误,请转到config/database.php文件并添加以下选项.

Previously i did not have the id1767899_ prefix on the database name and username. You get this prefix on the manage database link, where there is a button to manage your database. After adding this prefix you will get a new error like Wrong COM_STMT_PREPARE response size. Received 7 . To solve this error go to config/database.php file and add the following option.

'options' => [PDO::ATTR_EMULATE_PREPARES => true],

保存文件并再次登录.这对我有用.我找到了解决方案

Save the file and login again. This worked for me.I found the solution at the forums here

这篇关于用户"root" Laravel的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆