Php Laravel 8:SQLSTATE[28000][1045]拒绝用户访问(使用密码:是)
我刚把我的网站上传到服务器上,这是我的Php Laravel 8:SQLSTATE[28000][1045]拒绝用户访问(使用密码:是),php,mysql,laravel,cpanel,laravel-8,Php,Mysql,Laravel,Cpanel,Laravel 8,我刚把我的网站上传到服务器上,这是我的.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 但一旦我加载我的网站,我就会收到以下消息: illumb\Database\QueryException SQLSTATE[28000][1045]Access 拒绝用户“my_user”@'127.0.0.1'(使用密码:是
.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
但一旦我加载我的网站,我就会收到以下消息:
illumb\Database\QueryException SQLSTATE[28000][1045]Access
拒绝用户“my_user”@'127.0.0.1'(使用密码:是)(SQL:
从用户
中选择count(*)作为聚合,其中电话
=11111111)
下面是表用户的迁移:
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();
});
}
那么这里出了什么问题?我已经正确地创建了数据库并导入了表,还向其中添加了特权用户
如果你知道如何解决这个问题,请告诉我
谢谢。此问题的根源在于数据库的用户名和/或密码不正确。您是否在与web服务器相同的IP下运行mysql服务器?如何检查web服务器的IP?@tejoslaeslio您可以登录到您的web主机并从那里找到web服务器IP,或者使用更黑客的方法在google上找到DNS检查器并输入您的网站地址,然后返回其IP。
DB_CONNECTION=mysql
DB_HOST=abc.com //use domain name or ip address
DB_PORT=3306
DB_DATABASE=dsstudentda //server database name
DB_USERNAME=planetdss //server database username
DB_PASSWORD=16743646@ //server database password