gpt4 book ai didi

php - Laravel 拒绝用户 'root' @'localhost' 访问(使用密码 : YES) in laravel 5. 7

转载 作者:行者123 更新时间:2023-12-04 01:49:50 25 4
gpt4 key购买 nike

我有一个 laravel 5.7.13 博客,它在我的本地服务器上运行良好。但是在将它部署到实时共享的 cpanel 服务器后,即使我更新了我的 .evn 文件,数据库也不会连接。

.env 更新文件:

APP_NAME=EXTRAKOBO
APP_ENV=local
APP_KEY=base64:1Z6bkcUcgfoN6+cWghKDhRglrQStTg7aXaZI=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=ondi_myblog
DB_USERNAME=ondi_blog
DB_PASSWORD=abcd13

以下是我遇到的错误:

/home/ondi/miniblog/vendor/laravel/framework/src/Illuminate/Database/Connection.php

/**
* @param array $bindings
* @param \Closure $callback
* @return mixed
*
* @throws \Illuminate\Database\QueryException
*/
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try {
$result = $callback($query, $bindings);
}

// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (Exception $e) {
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}

return $result;
}

参数

1. "SQLSTATE[28000] [1045] Access denied for user 'ondi_blog'@'localhost' 
(using password: YES) (SQL: select count(*) as aggregate from `posts`)"

拜托,我需要帮助来解决这个问题。谢谢你的帮助

最佳答案

因为你已经在服务器上,所以你不能执行 artisan 命令。你可以做类似的事情。

Route::get('/clear-config', function() {
$exitCode = Artisan::call('config:clear');
return "config clear";

});

关于php - Laravel 拒绝用户 'root' @'localhost' 访问(使用密码 : YES) in laravel 5. 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53681395/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com