简体   繁体   English

用户'root'Laravel的访问被拒绝

[英]Access denied for user '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`)

this is my .env file: 这是我的.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? 为什么会出现此错误?

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

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. 我在000webhost.com上免费托管了laravel 5.3网站。 This error shows up i think when your login credentials are wrong. 我认为当您的登录凭据错误时会出现此错误。 Here is my MYSQL connection details in my .env file. 这是我的.env文件中的MYSQL连接详细信息。

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

Previously i did not have the id1767899_ prefix on the database name and username. 以前,我在数据库名称和用户名上没有id1767899_前缀。 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 添加此前缀后,您将收到一个新错误,例如Wrong COM_STMT_PREPARE response size. Received 7 Wrong COM_STMT_PREPARE response size. Received 7 . Wrong COM_STMT_PREPARE response size. Received 7 To solve this error go to config/database.php file and add the following option. 要解决此错误,请转到config / database.php文件并添加以下选项。

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

Save the file and login again. 保存文件并再次登录。 This worked for me.I found the solution at the forums here 这对我有用。我在这里的论坛上找到了解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM