Skip to content

auth failed for unknown reason #640

@lobermann

Description

@lobermann

Hi,

I am sure, as I am unable to find something similar via google since like 4 hours, that this is some issue that I am responsible for, but I am not able to find it out.

When calling "php artisan migrate" I get a

[MongoConnectionException]
  Failed to connect to: 192.168.111.200:27018: Authentication failed on database 'stats' with username 'stats': auth failed

The Migration file looks like this, just created it with artisan:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->text("username");
            $table->text("password");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }
}

db config:

'mongodb' => array(
            'driver'   => 'mongodb',
            'host'     => env('DB_HOST', 'localhost'),
            'port'     => env('DB_PORT', 27017),
            'database' => env('DB_DATABASE', ''),
            'username' => env('DB_USERNAME', ''),
            'password' => env('DB_PASSWORD', ''),
            'options' => array(
                'db' => env('DB_AUTH_DATABASE', '') // sets the authentication database required by mongo 3
            )
        ),

And the used versions:

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "jenssegers/mongodb": "^2.2"
    },

So far the values look good, and I can also connect via mongo to the server with the provided details. Can this be related to the new auth method from Mongo 3?

Any hint on gettings this resolved is appreciated. Thanks.

Short Update, here the actual exception via -vvv

 () at /usr/share/nginx/html/api/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Connection.php:152
 MongoClient->__construct() at /usr/share/nginx/html/api/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Connection.php:152
 Jenssegers\Mongodb\Connection->createConnection() at /usr/share/nginx/html/api/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Connection.php:37
 Jenssegers\Mongodb\Connection->__construct() at /usr/share/nginx/html/api/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/MongodbServiceProvider.php:26
 Jenssegers\Mongodb\MongodbServiceProvider->Jenssegers\Mongodb\{closure}() at n/a:n/a
 call_user_func() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:163
 Illuminate\Database\DatabaseManager->makeConnection() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:67
 Illuminate\Database\DatabaseManager->connection() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:171
 Illuminate\Database\Migrations\DatabaseMigrationRepository->getConnection() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:139
 Illuminate\Database\Migrations\DatabaseMigrationRepository->repositoryExists() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:393
 Illuminate\Database\Migrations\Migrator->repositoryExists() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:100
 Illuminate\Database\Console\Migrations\MigrateCommand->prepareDatabase() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:58
 Illuminate\Database\Console\Migrations\MigrateCommand->fire() at n/a:n/a
 call_user_func_array() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Container/Container.php:503
 Illuminate\Container\Container->call() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
 Illuminate\Console\Command->execute() at /usr/share/nginx/html/api/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
 Illuminate\Console\Command->run() at /usr/share/nginx/html/api/vendor/symfony/console/Application.php:838
 Symfony\Component\Console\Application->doRunCommand() at /usr/share/nginx/html/api/vendor/symfony/console/Application.php:189
 Symfony\Component\Console\Application->doRun() at /usr/share/nginx/html/api/vendor/symfony/console/Application.php:120
 Symfony\Component\Console\Application->run() at /usr/share/nginx/html/api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
 Illuminate\Foundation\Console\Kernel->handle() at /usr/share/nginx/html/api/artisan:36

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions