monicahq / monica

Personal CRM. Remember everything about your friends, family and business relationships.
https://beta.monicahq.com
GNU Affero General Public License v3.0
21.53k stars 2.15k forks source link

Error when starting using docker (docker-compose) #4241

Closed danggrianto closed 4 years ago

danggrianto commented 4 years ago

When i am starting monica using docker-compose I this error:

monica_1  | In Connection.php line 671:
monica_1  |
monica_1  |   [Illuminate\Database\QueryException (2054)]
monica_1  |   SQLSTATE[HY000] [2054] The server requested authentication method unknown t
monica_1  |   o the client (SQL: select DEFAULT_CHARACTER_SET_NAME from information_schem
monica_1  |   a.schemata where schema_name = monica)
monica_1  |
monica_1  |
monica_1  | Exception trace:
monica_1  |   at /var/www/monica/vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
monica_1  |  Illuminate\Database\Connection->runQueryCallback() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Database/Connection.php:631
monica_1  |  Illuminate\Database\Connection->run() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Database/Connection.php:339
monica_1  |  Illuminate\Database\Connection->select() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:367
monica_1  |  Illuminate\Database\DatabaseManager->__call() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261
monica_1  |  Illuminate\Support\Facades\Facade::__callStatic() at /var/www/monica/app/Console/Commands/Update.php:127
monica_1  |  App\Console\Commands\Update->migrateCollationTest() at /var/www/monica/app/Console/Commands/Update.php:92
monica_1  |  App\Console\Commands\Update->handle() at n/a:n/a
monica_1  |  call_user_func_array() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:33
monica_1  |  Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Container/Util.php:36
monica_1  |  Illuminate\Container\Util::unwrapIfClosure() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:91
monica_1  |  Illuminate\Container\BoundMethod::callBoundMethod() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
monica_1  |  Illuminate\Container\BoundMethod::call() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Container/Container.php:592
monica_1  |  Illuminate\Container\Container->call() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Console/Command.php:134
monica_1  |  Illuminate\Console\Command->execute() at /var/www/monica/vendor/symfony/console/Command/Command.php:255
monica_1  |  Symfony\Component\Console\Command\Command->run() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Console/Command.php:121
monica_1  |  Illuminate\Console\Command->run() at /var/www/monica/vendor/symfony/console/Application.php:912
monica_1  |  Symfony\Component\Console\Application->doRunCommand() at /var/www/monica/vendor/symfony/console/Application.php:264
monica_1  |  Symfony\Component\Console\Application->doRun() at /var/www/monica/vendor/symfony/console/Application.php:140
monica_1  |  Symfony\Component\Console\Application->run() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Console/Application.php:93
monica_1  |  Illuminate\Console\Application->run() at /var/www/monica/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:129
monica_1  |  Illuminate\Foundation\Console\Kernel->handle() at /var/www/monica/artisan:37
monica_1  |
monica_1  | In PDOConnection.php line 31:
monica_1  |
monica_1  |   [Doctrine\DBAL\Driver\PDOException (2054)]
monica_1  |   SQLSTATE[HY000] [2054] The server requested authentication method unknown t
monica_1  |   o the client

This is my .env file

#
# Welcome, friend ❤. Thanks for trying out Monica. We hope you'll have fun.
#

# Two choices: local|production. Use local if you want to install Monica as a
# development version. Use production otherwise.
APP_ENV=local

# true if you want to show debug information on errors. For production, put this
# to false.
APP_DEBUG=false

# The encryption key. This is the most important part of the application. Keep
# this secure otherwise, everyone will be able to access your application.
# Must be 32 characters long exactly.
# Use `php artisan key:generate` or `pwgen -s 32 1` to generate a random key.
APP_KEY=ChangeMeBy32KeyLengthOrGenerated

# Prevent information leakage by referring to IDs with hashIds instead of
# the actual IDs used in the database.
HASH_SALT=ChangeMeBy20+KeyLength
HASH_LENGTH=18

# The URL of your application.
APP_URL=http://localhost

# Force using APP_URL as base url of your application.
# You should not need this, unless you are using subdirectory config.
APP_FORCE_URL=false

# Database information
# To keep this information secure, we urge you to change the default password
# Currently only "mysql" compatible servers are working
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
# You can use mysql unix socket if available, it overrides DB_HOST and DB_PORT values.
#DB_UNIX_SOCKET=/var/run/mysqld/mysqld.sock
DB_DATABASE=monica
DB_USERNAME=root
DB_PASSWORD=P@$$W0rd!
DB_PREFIX=
DB_TEST_HOST=db
DB_TEST_DATABASE=monica_test
DB_TEST_USERNAME=homestead
DB_TEST_PASSWORD=secret

# Use utf8mb4 database charset format to support emoji characters
# ⚠ be sure your DBMS supports utf8mb4 format
DB_USE_UTF8MB4=true

# Mail credentials used to send emails from the application.
MAIL_MAILER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
# Outgoing emails will be sent with these identity
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME="Monica instance"
# New registration notification sent to this email
APP_EMAIL_NEW_USERS_NOTIFICATION=

# Ability to disable signups on your instance.
# Can be true or false. Default to false.
APP_DISABLE_SIGNUP=true

# Enable user email verification.
APP_SIGNUP_DOUBLE_OPTIN=false

# Set trusted proxy IP addresses.
# To trust all proxies that connect directly to your server, use a "*".
# To trust one or more specific proxies that connect directly to your server,
# use a comma separated list of IP addresses.
APP_TRUSTED_PROXIES=

# Enable automatic cloudflare trusted proxy discover
APP_TRUSTED_CLOUDFLARE=false

# Frequency of creation of new log files. Logs are written when an error occurs.
# Refer to config/logging.php for the possible values.
LOG_CHANNEL=daily

# Error tracking. Specific to hosted version on .com. You probably don't need
# those.
SENTRY_SUPPORT=false
SENTRY_LARAVEL_DSN=

# Send a daily ping to https://version.monicahq.com to check if a new version
# is available. When a new version is detected, you will have a message in the
# UI, as well as the release notes for the new changes. Can be true or false.
# Default to true.
CHECK_VERSION=true

# Cache, session, and queue parameters
# ⚠ Change this only if you know what you are doing
#. Cache: database, file, memcached, redis, dynamodb
#. Session: file, cookie, database, apc, memcached, redis, array
#. Queue: sync, database, beanstalkd, sqs, redis
#  If Queue is not set to 'sync', you'll have to set a queue worker
#  See https://laravel.com/docs/5.7/queues#running-the-queue-worker
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_CONNECTION=sync

# If you use redis, set the redis host or ip, like:
#REDIS_HOST=redis

# Maximum allowed size for uploaded files, in kilobytes.
# Make sure this is an integer, without commas or spaces.
DEFAULT_MAX_UPLOAD_SIZE=10240

# Maximum allowed storage size per account, in megabytes.
# Make sure this is an integer, without commas or spaces.
DEFAULT_MAX_STORAGE_SIZE=512

# Default filesystem to store uploaded files.
# Possible values: public|s3
DEFAULT_FILESYSTEM=public

# AWS keys for S3 when using this storage method
AWS_KEY=
AWS_SECRET=
AWS_REGION=us-east-1
AWS_BUCKET=
AWS_SERVER=

# Allow Two Factor Authentication feature on your instance
MFA_ENABLED=true

# Enable DAV support
DAV_ENABLED=true

# CLIENT ID and SECRET used for the official mobile application
# This is to make sure that only the mobile application that you approve can
# access the route to let your users sign in with their credentials
# Note: the official mobile application is not currently available on the stores.
MOBILE_CLIENT_ID=
MOBILE_CLIENT_SECRET=

# Allow to access general statistics about your instance through a public API
# call
ALLOW_STATISTICS_THROUGH_PUBLIC_API_ACCESS=false

# Indicates that each user in the instance must comply to international policies
# like CASL or GDPR
POLICY_COMPLIANT=true

# Enable geolocation services
# This is used to translate addresses to GPS coordinates.
ENABLE_GEOLOCATION=false

# API key for geolocation services
# We use LocationIQ (https://locationiq.com/) to translate addresses to
# latitude/longitude coordinates. We could use Google instead but we don't
# want to give anything to Google, ever.
# LocationIQ offers 10,000 free requests per day.
LOCATION_IQ_API_KEY=

# Enable weather on contact profile page
# Weather can only be fetched if we know longitude/latitude - this is why
# you also need to activate the geolocation service above to make it work
ENABLE_WEATHER=false

# Access to weather data from darksky api
# https://darksky.net/dev/register
# Darksky provides an api with 1000 free API calls per day
# You need to enable the weather above if you provide an API key here.
DARKSKY_API_KEY=

This is my docker-compose.yml file:

version: '3.1'

services:

  monica:
    image: monicahq/monicahq
    restart: unless-stopped
    ports:
      - 8181:80
    env_file: monica.env
    depends_on:
      - db

  db:
    image: mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: P@$$W0rd!
    volumes:
      - ~/db:/var/lib/mysql
SirTerrific commented 4 years ago

What was the solution ? I have the same issue with docker

earlng commented 4 years ago

What was the solution ? I have the same issue with docker

@SirTerrific I encountered this issue. I solved it (or at least, it started working) when I changed the DB_USERNAME value to homestead (and making sure that this user has the appropriate permissions to the database, which you can name anything).

Originally I set it to something like monica_user (per my own naming convention), but container wouldn't run correctly. I kept getting an error that said it couldn't access the DB.

I'm not sure if this solves your issue, but I imagine worth a try.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.