Install Aimeos in separate database
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Install Aimeos in separate database
Trying to install Aimeos in different database from core Laravel app database but I only get migration table
Did add
and in database/config.php I added
Sother tables are added besides migrations table and an invites table based on another package that I do not need in this database and I get this error post
:
And yes I did run
Did add
Code: Select all
DB_CONNECTION=mysql_aimeos
DB_AIMEOS_HOST=localhost
DB_AIMEOS_DATABASE=aimeos
DB_AIMEOS_USERNAME=root
DB_AIMEOS_PASSWORD=
DB_AIMEOS_PORT=3306
Code: Select all
'mysql_aimeos' => [
'driver' => 'mysql',
'host' => env('DB_AIMEOS_HOST', '127.0.0.1'),
'port' => env('DB_AIMEOS_PORT', '3306'),
'database' => env('DB_AIMEOS_DATABASE', 'forge'),
'username' => env('DB_AIMEOS_USERNAME', 'forge'),
'password' => env('DB_AIMEOS_PASSWORD', ''),
'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'),
]) : [],
],
Code: Select all
php artisan migrate --database=mysql_aimeos
Code: Select all
INFO Preparing database.
Creating migration table ............................................................................................................... 37ms DONE
INFO Running migrations.
2017_04_04_185723_create_invites_table ................................................................................................ 127ms DONE
Code: Select all
composer update -W
php artisan vendor:publish --tag=config --tag=public
Re: Install Aimeos in separate database
You have to adapt the database configuration in the ./config/shop.php file:
https://github.com/aimeos/aimeos-larave ... hp#L51-L66
https://github.com/aimeos/aimeos-larave ... hp#L51-L66
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Install Aimeos in separate database
I added
to config/shop.php. Already had
in config/database.php but I guess that did not work. However, still getting nothing extra on php artisan migrate --database=mysql_aimeos so I think I need something to load `DB_CONNECTION=mysql_aimeos` as well
Code: Select all
...
'resource' => [
'db' => [
'adapter' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.driver', 'mysql' ),
'host' => config('DB_AIMEOS_HOST', '127.0.0.1'),
'port' => config('DB_AIMEOS_PORT', '3306'),
'socket' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.unix_socket', '' ),
'database' => config('DB_AIMEOS_DATABASE', 'aimeos'),
'username' => config('DB_AIMEOS_USERNAME', 'forge'),
'password' => config('DB_AIMEOS_PASSWORD', ''),
'stmt' => config( 'database.default', 'mysql' ) === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
'limit' => 3, // maximum number of concurrent database connections
'defaultTableOptions' => [
'charset' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.charset' ),
'collate' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.collation' ),
],
'driverOptions' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.options' ),
],
...
Code: Select all
...
'mysql_aimeos' => [
'driver' => 'mysql',
'host' => env('DB_AIMEOS_HOST', '127.0.0.1'),
'port' => env('DB_AIMEOS_PORT', '3306'),
'database' => env('DB_AIMEOS_DATABASE', 'forge'),
'username' => env('DB_AIMEOS_USERNAME', 'forge'),
'password' => env('DB_AIMEOS_PASSWORD', ''),
'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'),
]) : [],
],
...
Re: Install Aimeos in separate database
Then I ran
So perhaps something else I still missed?
Code: Select all
php artisan aimeos:setup
Aimeos\Base\DB\Exception
An exception occurred in the driver: SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'aimeos': SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'
at vendor/aimeos/aimeos-base/src/DB/Statement/DBAL/Simple.php:75
71▕ {
72▕ try {
73▕ $result = $this->getConnection()->getRawObject()->getWrappedConnection()->query( $this->sql );
74▕ } catch( \Doctrine\DBAL\Driver\Exception $e ) {
➜ 75▕ throw new \Aimeos\Base\DB\Exception( $e->getMessage() . ': ' . $this->sql, $e->getCode() );
76▕ }
77▕
78▕ return new \Aimeos\Base\DB\Result\DBAL( $result );
79▕ }
+22 vendor frames
23 artisan:35
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Re: Install Aimeos in separate database
According to your error message, the user name isn't passed for login into the database.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Install Aimeos in separate database
The Aimeos shop.php configuration file with
did not pass on data. Or it did not show what user used in the mentioned error. I assumed it would load data from .env but it did not hence the `''` without username mentioned. When I used root as user in `config/shop.php`
all was well and migrations ran. Very odd . When I checked the value
it was fine and loaded. So what did
not first try and get aimeos username from .env:
Code: Select all
'username' => config('DB_AIMEOS_USERNAME', 'forge'),
did not pass on data. Or it did not show what user used in the mentioned error. I assumed it would load data from .env but it did not hence the `''` without username mentioned. When I used root as user in `config/shop.php`
Code: Select all
'resource' => [
'db' => [
'adapter' => config('database.connections.'.config('database.default', 'mysql').'.driver', 'mysql'),
'host' => config('DB_AIMEOS_HOST', 'localhost'),
'port' => config('DB_AIMEOS_PORT', '3306'),
'socket' => config('database.connections.'.config('database.default', 'mysql').'.unix_socket', ''),
'database' => config('DB_AIMEOS_DATABASE', 'aimeos'),
'username' => config('DB_AIMEOS_USERNAME', 'root'),
'password' => config('DB_AIMEOS_PASSWORD', ''),
'stmt' => config('database.default', 'mysql') === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
'limit' => 3, // maximum number of concurrent database connections
'defaultTableOptions' => [
'charset' => config('database.connections.'.config('database.default', 'mysql').'.charset'),
'collate' => config('database.connections.'.config('database.default', 'mysql').'.collation'),
],
'driverOptions' => config('database.connections.'.config('database.default', 'mysql').'.options'),
],
Code: Select all
php artisan tinker
Psy Shell v0.12.3 (PHP 8.2.15 — cli) by Justin Hileman
> echo getenv('DB_AIMEOS_USERNAME');
root⏎
Code: Select all
'username' => config('DB_AIMEOS_USERNAME', 'forge'),
Code: Select all
# DB_CONNECTION=mysql_aimeos
DB_AIMEOS_CONNECTION=mysql_aimeos
DB_AIMEOS_HOST=localhost
DB_AIMEOS_PORT=3306
DB_AIMEOS_DATABASE=aimeos
DB_AIMEOS_USERNAME=root
DB_AIMEOS_PASSWORD=
Re: Install Aimeos in separate database
My bad. I needed env:
That did allow environmental values to load.. of course. Thanks for all your input.
Code: Select all
...
'resource' => [
'db' => [
'adapter' => config('database.connections.' . config('database.default', 'mysql') . '.driver', 'mysql'),
'host' => env('DB_AIMEOS_HOST', 'localhost'),
'port' => env('DB_AIMEOS_PORT', '3306'),
'socket' => config('database.connections.' . config('database.default', 'mysql') . '.unix_socket', ''),
'database' => env('DB_AIMEOS_DATABASE', 'aimeos'),
'username' => env('DB_AIMEOS_USERNAME', 'forge'),
'password' => env('DB_AIMEOS_PASSWORD', ''),
'stmt' => config('database.default', 'mysql') === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
'limit' => 3, // maximum number of concurrent database connections
'defaultTableOptions' => [
'charset' => config('database.connections.' . config('database.default', 'mysql') . '.charset'),
'collate' => config('database.connections.' . config('database.default', 'mysql') . '.collation'),
],
'driverOptions' => config('database.connections.' . config('database.default', 'mysql') . '.options'),
],
...