exceedone / exment

Exment is open source software for managing information assets on the Web. / Exmentは、情報資産をWeb上で管理するための、オープンソースソフトウェアです。
https://exment.net/docs/#
GNU General Public License v3.0
269 stars 68 forks source link

外部データベースへの接続 #1262

Closed yamada1227 closed 1 year ago

yamada1227 commented 1 year ago

Describe the bug / バグの説明

A clear and concise description of what the bug is. / バグの内容のかんたんな説明を記載してください。 Windows10にExment(XAMPP構築)と外部DBとしてMySQLをインストールしました。 外部DBとなるMySQLについてはポートをデフォルトから変更。 下記URLの設定に従い、サンプルデータベースのworldに設定を実行しました。 https://exment.net/docs_pre/#/ja/plugin_quickstart_crud ※外部DBのMySQLのポート、ユーザー、パスワードについては正しいものを設定

To Reproduce / 再現手順

Please describe the reproduction procedure in as much detail as possible. / 再現手順を、可能な限り詳細に記載してください。 上記URLの内容に従い、config.json、Plugin.phpを作成し、これを圧縮したZIPファイルをExmentメニューの管理者設定→ プラグインでプラグインファイルアップロードを実行。 アップロードされたプラグインファイルをクリックし、プラグイン管理画面に表示された「このプラグインにアクセスする ためのエンドポイントです。」のURLに接続。 下記エラーが表示される。 admin.error_exception SQLSTATE[HY000] [1049] Unknown database 'world' (SQL: select count(*) as aggregate from city)

Version / 発生バージョン

Please describe version. / ご利用のバージョンを記載してください。 1月13日に下記URLよりダウンロード https://exment.net/downloads/ja/exment.zip

Error log / エラーログ

If possible, paste error log. Log's path is "storage/logs/laravel.log". / 可能であれば、ログを貼り付けてください。ログのパスは"storage/logs/laravel.log"です。 Next Illuminate\Database\QueryException: SQLSTATE[HY000] [1049] Unknown database 'world' (SQL: select count(*) as aggregate from city) in C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Connection.php:760 Stack trace:

0 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Connection.php(720): Illuminate\Database\Connection->runQueryCallback('select count(*)...', Array, Object(Closure))

1 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Connection.php(422): Illuminate\Database\Connection->run('select count(*)...', Array, Object(Closure))

2 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2650): Illuminate\Database\Connection->select('select count(*)...', Array, true)

3 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2638): Illuminate\Database\Query\Builder->runSelect()

4 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(3174): Illuminate\Database\Query\Builder->Illuminate\Database\Query{closure}()

5 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2639): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))

6 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2788): Illuminate\Database\Query\Builder->get()

7 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2747): Illuminate\Database\Query\Builder->runPaginationCountQuery(Array)

8 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2667): Illuminate\Database\Query\Builder->getCountForPagination()

9 C:\xampp\local\exment\storage\app\plugins\MySQLWorld\Plugin.php(70): Illuminate\Database\Query\Builder->paginate(20, Array, 'page', 1)

10 C:\xampp\local\exment\vendor\exceedone\exment\src\Services\Plugin\PluginCrud\CrudGrid.php(63): App\Plugins\MySQLWorld\Plugin->getPaginate(Array)

11 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Widgets\Grid\Grid.php(287): Exceedone\Exment\Services\Plugin\PluginCrud\CrudGrid->Exceedone\Exment\Services\Plugin\PluginCrud{closure}(Object(Encore\Admin\Widgets\Grid\Grid), Array)

12 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Widgets\Grid\Grid.php(253): Encore\Admin\Widgets\Grid\Grid->getPaginatorData()

13 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Widgets\Grid\Grid.php(775): Encore\Admin\Widgets\Grid\Grid->getData()

14 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Widgets\Grid\Grid.php(753): Encore\Admin\Widgets\Grid\Grid->build()

15 C:\xampp\local\exment\vendor\exceedone\exment\src\Services\Plugin\PluginCrud\CrudGrid.php(25): Encore\Admin\Widgets\Grid\Grid->render()

16 C:\xampp\local\exment\vendor\exceedone\exment\src\Services\Plugin\PluginCrudController.php(35): Exceedone\Exment\Services\Plugin\PluginCrud\CrudGrid->index()

17 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): Exceedone\Exment\Services\Plugin\PluginCrudController->index(NULL)

18 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction('index', Array)

19 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Route.php(260): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Exceedone\Exment\Services\Plugin\PluginCrudController), 'index')

20 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Route.php(205): Illuminate\Routing\Route->runController()

21 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Router.php(798): Illuminate\Routing\Route->run()

22 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))

23 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Middleware\Session.php(18): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

24 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Encore\Admin\Middleware\Session->handle(Object(Illuminate\Http\Request), Object(Closure))

25 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Middleware\Permission.php(42): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

26 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Encore\Admin\Middleware\Permission->handle(Object(Illuminate\Http\Request), Object(Closure))

27 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Middleware\Bootstrap.php(15): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

28 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Encore\Admin\Middleware\Bootstrap->handle(Object(Illuminate\Http\Request), Object(Closure))

29 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\LogOperation.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

30 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\LogOperation->handle(Object(Illuminate\Http\Request), Object(Closure))

31 C:\xampp\local\exment\vendor\exceedone\laravel-admin\src\Middleware\Pjax.php(24): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

32 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Encore\Admin\Middleware\Pjax->handle(Object(Illuminate\Http\Request), Object(Closure))

33 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\Bootstrap.php(22): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

34 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\Bootstrap->handle(Object(Illuminate\Http\Request), Object(Closure))

35 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\Morph.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

36 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\Morph->handle(Object(Illuminate\Http\Request), Object(Closure))

37 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\AuthenticatePasswordLimit.php(24): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

38 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\AuthenticatePasswordLimit->handle(Object(Illuminate\Http\Request), Object(Closure))

39 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\Authenticate2factor.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

40 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\Authenticate2factor->handle(Object(Illuminate\Http\Request), Object(Closure))

41 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\Authenticate.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

42 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))

43 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\Initialize.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

44 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\Initialize->handle(Object(Illuminate\Http\Request), Object(Closure))

45 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\IpFilterBase.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

46 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\WebIPFilter.php(15): Exceedone\Exment\Middleware\IpFilterBase->handleBase(Object(Illuminate\Http\Request), Object(Closure), 'web_ip_filters')

47 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\WebIPFilter->handle(Object(Illuminate\Http\Request), Object(Closure))

48 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\Browser.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

49 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\Browser->handle(Object(Illuminate\Http\Request), Object(Closure))

50 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

51 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))

52 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

53 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))

54 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

55 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))

56 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

57 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))

58 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))

59 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

60 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))

61 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

62 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))

63 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

64 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Router.php(799): Illuminate\Pipeline\Pipeline->then(Object(Closure))

65 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Router.php(776): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

66 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Router.php(740): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

67 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Routing\Router.php(729): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

68 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(190): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

69 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))

70 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\ExmentDebug.php(15): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

71 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\ExmentDebug->handle(Object(Illuminate\Http\Request), Object(Closure))

72 C:\xampp\local\exment\vendor\exceedone\exment\src\Middleware\TrustProxies.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

73 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Exceedone\Exment\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

74 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

75 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

76 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))

77 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

78 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

79 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))

80 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

81 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

82 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

83 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))

84 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Http\Middleware\HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

85 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))

86 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Http\Middleware\TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

87 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

88 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

89 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(165): Illuminate\Pipeline\Pipeline->then(Object(Closure))

90 C:\xampp\local\exment\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(134): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

91 C:\xampp\local\exment\public\index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

92 {main}

Screenshots / スクリーンショット

If possible, paste the screenshot. / 可能であれば、スクリーンショットを貼り付けてください。 image

Additional context / その他

Add any other context about the problem here. / その他に記載すべき内容がありましたら、ご記載ください。

yamada1227 commented 1 year ago

自己解決しました。 config/database.phpの設定が書かれているサイトおよびファイルを下記のように修正してください。 env関数で設定されている環境変数については、他で定義したものと共有しないのであれば、 ユニークな変数にする必要があります。

   'world' => [
        'driver' => 'mysql',
        'url' => env('DATABASE_URL_WORLD'),
        'host' => env('DB_HOST_WORLD', '127.0.0.1'),
        'port' => env('DB_PORT_WORLD', '3306'),
        'database' => env('DB_DATABASE_WORLD', 'world'),
        'username' => env('DB_USERNAME_WORLD', 'forge'),
        'password' => env('DB_PASSWORD_WORLD', ''),
        'unix_socket' => env('DB_SOCKET_WORLD', ''),
        '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'),
        ]) : [],
    ],
KajitoriAdmin commented 1 year ago

Closeとします。