Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database always shows access denied no matter what the passwords are set in the Env #702

Open
Dvalin21 opened this issue Oct 11, 2024 · 2 comments

Comments

@Dvalin21
Copy link

Dvalin21 commented Oct 11, 2024

As the title says. Here is my log

2024-10-11 00:21:55+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.2.44+maria~bionic started.
2024-10-11 00:21:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-10-11 00:21:56+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.2.44+maria~bionic started.
2024-10-11 00:21:56+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
2024-10-11  0:21:56 139823765046976 [Note] mysqld (mysqld 10.2.44-MariaDB-1:10.2.44+maria~bionic) starting as process 1 ...
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Uses event mutexes
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Using Linux native AIO
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Number of pools: 1
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Using SSE2 crc32 instructions
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Completed initialization of buffer pool
2024-10-11  0:21:56 139823043397376 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Highest supported file format is Barracuda.
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: 128 out of 128 rollback segments are active.
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Creating shared tablespace for temporary tables
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2024-10-11  0:21:56 139823765046976 [Note] InnoDB: 5.7.38 started; log sequence number 2293829
2024-10-11  0:21:56 139822878398208 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2024-10-11  0:21:56 139823765046976 [Note] Plugin 'FEEDBACK' is disabled.
2024-10-11  0:21:56 139823765046976 [Note] Server socket created on IP: '0.0.0.0'.
2024-10-11  0:21:56 139823765046976 [Note] Reading of all Master_info entries succeeded
2024-10-11  0:21:56 139823765046976 [Note] Added new Master_info '' to hash table
2024-10-11  0:21:56 139823765046976 [Note] mysqld: ready for connections.
Version: '10.2.44-MariaDB-1:10.2.44+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2024-10-11  0:21:56 139822878398208 [Note] InnoDB: Buffer pool(s) load completed at 241011  0:21:56
2024-10-11  0:21:57 139823603558144 [Warning] Access denied for user 'bigcapital'@'172.21.0.7' (using password: YES)
2024-10-11  0:21:59 139823603558144 [Warning] Access denied for user 'bigcapital'@'172.21.0.8' (using password: YES)

Made sure that the passwords for root and the database was at least 8 to 12 characters, at least one capital, lowercase, digit, and special character. Still I get this error. Thanks in advance

Update:
So what I have discovered is that the password for bigcapital (or any username you put in the env) is not being allowed to set a password even though its set in env. Also notice two different 'root' accounts, one with access for remote and the other with localhost only.

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.2.44-MariaDB-1:10.2.44+maria~bionic mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT User, Host FROM mysql.user;
+------------+-----------+
| User       | Host      |
+------------+-----------+
| bigcapital | %         |
| root       | %         |
| root       | localhost |
+------------+-----------+
3 rows in set (0.00 sec)

I was think that the root@% probably shouldn't be there.

At any case
I had to docker exec into the mysql container and manually set the password for db_user:bigcapital. The .env setting it does not work. It only leaves it blank.

ALTER USER 'bigcapital'@'%' IDENTIFIED BY 'your_password';

FLUSH PRIVILEGES;

MariaDB [(none)]> ALTER USER 'bigcapital'@'%' IDENTIFIED BY 'your_password';
Query OK, 0 rows affected (0.00 sec)

After doing so, I exited our and restarted the container.
Now I get this error

2024-10-11 21:13:17 140555026089728 [Warning] Aborted connection 9 to db: 'bigcapital_system' user: 'bigcapital' host: '172.21.0.8' (Got an error reading communication packets)
2024-10-11 21:13:17 140555026089728 [Warning] Aborted connection 10 to db: 'bigcapital_system' user: 'bigcapital' host: '172.21.0.8' (Got an error reading communication packets)
@Dvalin21
Copy link
Author

Logs from the server

Delete expired import files has started.
Error: connect ECONNREFUSED 172.21.0.3:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
    --------------------
    at Protocol._enqueue (/app/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/app/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at Connection.connect (/app/node_modules/.pnpm/[email protected]/node_modules/mysql/lib/Connection.js:116:18)
    at /app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/knex/lib/dialects/mysql/index.js:71:18
    at new Promise (<anonymous>)
    at Client_MySQL.acquireRawConnection (/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/knex/lib/dialects/mysql/index.js:66:12)
    at create (/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/knex/lib/client.js:262:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '172.21.0.3',
  port: 3306,
  fatal: true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant