在 000webhost.com 托管网站的问题



这是托管服务器中的数据库属性所以我正在托管使用laravel的网站,老实说我以前做过这个,结果没有问题,但这次它是如此令人沮丧,所以在我上传我的文件和我的数据库 000webhost.com 之后,我将应用程序密钥从.env复制到/config/app.php之后我从 000webhost.com 添加了新的主机和数据库名称,就是这样?它应该可以工作,但它显示了此错误

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

我不知道数据库是否已经连接,我什至没有一个名为root的用户,我已经将其更改为 000webhost.com 给我的内容

所以这是我的 .env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:WlIDPJllsrTTV6XCtZgprK+0iy9SjyhiyGQXsKa3VzI=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=id10203308_laravel1
DB_USERNAME=id10203308_laravel1
DB_PASSWORD=laravel1
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

这是我的应用程序.php

'key' => env('APP_KEY', base64_decode('WlIDPJllsrTTV6XCtZgprK+0iy9SjyhiyGQXsKa3VzI=')),
    'cipher' => 'AES-256-CBC',

这是显示欢迎页面的控制器

<?php
namespace AppHttpControllers;
use IlluminateSupportFacadesDB;
use IlluminateHttpRequest;
use AppBlog;
class Blog1Controller extends Controller
{
    public function index()
    {
        $blogs = DB::table('blogs')->orderBy('id', 'DESC')->paginate(3);
        return view('welcome',[
            'blogs' => $blogs
        ]);
    }
}

这是路线

Auth::routes();Route::get('/home', 'HomeController@index')    
    ->name('home');Route::get('/admin', 'AdminController@admin')    
    ->middleware('is_admin')    
    ->name('admin');
    Route::get('/posting','BlogController@index')->name('blog');
    Route::post('/posting','BlogController@store')->name('blog.store');
    Route::post('/profile','BlogController@thumbnail')->name('blog.thumb');
    Route::get('/','Blog1Controller@index')->name('blog');
    Route::get('/review','ReviewController@index');

000webhost最终遇到了问题。您可以签入链接:https://www.000webhost.com/forum/t/sqlstate-hy000-1045-proxysql-error-access-denied-for-user/48044。

他们告诉你要继续努力。我的建议是,在您再次尝试之前,请从 laravel 应用程序中清除您的配置缓存。

您需要从存储中清除缓存文件,因为它会缓存 .env 变量。如果您可以从ssh访问您的网站文件,则需要运行php artisan cache:clearphp artisan config:clear而不是删除文件

最新更新