Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mohammednehru's avatar

DB problem on host

It's work now thank you. But there's a DB problem when registering a new user or adding anything to DB https://k.top4top.io/p_1503m2sz41.png

This is .env

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=boryelpa_yasDB
DB_USERNAME=boryelpa_yasUSER
DB_PASSWORD=12332100mm

database.php

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'boryelpa_yasDB'),
            'username' => env('DB_USERNAME', 'boryelpa_yasUSER'),
            'password' => env('DB_PASSWORD', '12332100mm'),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

database name in my host PHPMyAdmin https://g.top4top.io/p_150236a3n3.png

0 likes
11 replies
Sinnbeck's avatar

Try finding the users table in the db manager and check how the table is set up. id column should be set to autoincrement

onetwothreeneth's avatar

Database is setup correctly,

Problem occurs on your table schema.

Alter column 'id' as Auto increment

Sinnbeck's avatar

Under extra it should say AUTO_INCREMENT

Can you show the users migration file?

mohammednehru's avatar
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

It's work fine on my localhost

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Strange. Seems the remote host didnt work properly. You need to add that autoincrement (compare your screenshots)

Sinnbeck's avatar

Did you remember to save? Try hitting f5 and see if the setting persists

mohammednehru's avatar

The primary key missing in all tables in host db manager. I added and now it's work Thank you again

Please or to participate in this conversation.