繁体   English   中英

Laravel 8: SQLSTATE[28000] [1045] 拒绝用户访问(使用密码:YES)

[英]Laravel 8: SQLSTATE[28000] [1045] Access denied for user (using password: YES)

我刚刚将我的网站上传到服务器,这是我的.env文件:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_db
DB_USERNAME=my_user
DB_PASSWORD=my_pass

但是,一旦我加载我的网站,我就会收到以下消息:

Illuminate\Database\QueryException SQLSTATE[28000] [1045]用户'my_user'@'127.0.0.1'的访问被拒绝(使用密码:YES)(SQL:select 计数(*)作为phone = 11111111 的users的聚合)

这也是表users的迁移:

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('phone')->unique();
            $table->binary('image')->nullable();
            $table->string('job')->nullable();
            $table->string('location')->nullable();
            $table->string('bio')->nullable();
            $table->string('skills')->nullable();
            $table->string('stackoverflow')->nullable();
            $table->string('github')->nullable();
            $table->string('instagram')->nullable();
            $table->string('linkedin')->nullable();
            $table->string('website')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

那么这里出了什么问题呢? 我已经正确创建了数据库并导入了表,并且还添加了特权用户。

因此,如果您知道如何解决此问题,请告诉我...

谢谢。

我刚刚将我的网站上传到服务器,这是我的.env文件:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_db
DB_USERNAME=my_user
DB_PASSWORD=my_pass

但是,一旦我加载我的网站,我就会收到以下消息:

Illuminate\Database\QueryException SQLSTATE[28000] [1045]用户'my_user'@'127.0.0.1'的访问被拒绝(使用密码:YES)(SQL:select 计数(*)作为phone = 11111111 的users的聚合)

这也是表users的迁移:

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('phone')->unique();
            $table->binary('image')->nullable();
            $table->string('job')->nullable();
            $table->string('location')->nullable();
            $table->string('bio')->nullable();
            $table->string('skills')->nullable();
            $table->string('stackoverflow')->nullable();
            $table->string('github')->nullable();
            $table->string('instagram')->nullable();
            $table->string('linkedin')->nullable();
            $table->string('website')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

那么这里出了什么问题呢? 我已经正确创建了数据库并导入了表,并且还添加了特权用户。

因此,如果您知道如何解决此问题,请告诉我...

谢谢。

我刚刚将我的网站上传到服务器,这是我的.env文件:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_db
DB_USERNAME=my_user
DB_PASSWORD=my_pass

但是,一旦我加载我的网站,我就会收到以下消息:

Illuminate\Database\QueryException SQLSTATE[28000] [1045]用户'my_user'@'127.0.0.1'的访问被拒绝(使用密码:YES)(SQL:select 计数(*)作为phone = 11111111 的users的聚合)

这也是表users的迁移:

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('phone')->unique();
            $table->binary('image')->nullable();
            $table->string('job')->nullable();
            $table->string('location')->nullable();
            $table->string('bio')->nullable();
            $table->string('skills')->nullable();
            $table->string('stackoverflow')->nullable();
            $table->string('github')->nullable();
            $table->string('instagram')->nullable();
            $table->string('linkedin')->nullable();
            $table->string('website')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

那么这里出了什么问题呢? 我已经正确创建了数据库并导入了表,并且还添加了特权用户。

因此,如果您知道如何解决此问题,请告诉我...

谢谢。

暂无
暂无

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

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