I can't connect to MariaDB with the root user

Keywords: WordPress Multisite - Google Cloud Platform - Technical issue - Services (Apache, MariaDB, MySQL…)

bndiagnostic ID: 7dfa88df-b6ce-66f7-832e-f208872b3db5

bndiagnostic output:

? Wordpress: Found possible issues
? Apache: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/administration/understand-file-permissions/
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
After following all the instructions in the Secure MariaDB documentation Secure MariaDB it is not possible to access MariaDB in the command console (also not by PHPMyAdmin).

Using mysql -u root -p and entering the corresponding password, I get an error:

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

I have tried to Modify The Default MariaDB Administrator Password without success with the following documentations:
Change The MariaDB Root Password
Reset The MariaDB Root Password
https://docs.bitnami.com/google/apps/wordpress-multisite/administration/change-reset-password-mariadb/

Mariadb error log

2022-04-17 6:40:25 0 [Note] InnoDB: Shutdown completed; log sequence number 71555585126; transaction id 62710611
2022-04-17 6:40:25 0 [Note] /opt/bitnami/mariadb/sbin/mysqld: Shutdown complete

2022-04-17 6:40:25 0 [Note] InnoDB: Using Linux native AIO
2022-04-17 6:40:25 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-04-17 6:40:25 0 [Note] InnoDB: Uses event mutexes
2022-04-17 6:40:25 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-04-17 6:40:25 0 [Note] InnoDB: Number of pools: 1
2022-04-17 6:40:25 0 [Note] InnoDB: Using SSE2 crc32 instructions
2022-04-17 6:40:25 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2022-04-17 6:40:25 0 [Note] InnoDB: Completed initialization of buffer pool
2022-04-17 6:40:25 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-04-17 6:40:25 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2022-04-17 6:40:25 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-04-17 6:40:25 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
2022-04-17 6:40:25 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
2022-04-17 6:40:25 0 [Note] InnoDB: 10.3.29 started; log sequence number 71555585126; transaction id 62710604
2022-04-17 6:40:25 0 [Note] InnoDB: Loading buffer pool(s) from /bitnami/mariadb/data/ib_buffer_pool
2022-04-17 6:40:25 0 [Note] Plugin ‘FEEDBACK’ is disabled.
2022-04-17 6:40:25 0 [Note] Server socket created on IP: ‘127.0.0.1’.
2022-04-17 6:40:25 0 [Warning] ‘proxies_priv’ entry ‘@% root@multisakder-vm’ ignored in --skip-name-resolve mode.
2022-04-17 6:40:25 0 [Note] Reading of all Master_info entries succeeded
2022-04-17 6:40:25 0 [Note] Added new Master_info ‘’ to hash table
2022-04-17 6:40:25 0 [Note] /opt/bitnami/mariadb/sbin/mysqld: ready for connections.
Version: ‘10.3.29-MariaDB’ socket: ‘/opt/bitnami/mariadb/tmp/mysql.sock’ port: 3306 Source distribution
2022-04-17 6:40:26 0 [Note] InnoDB: Buffer pool(s) load completed at 220417 6:40:26
2022-04-17 6:40:54 8 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2022-04-17 6:52:08 40 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)
2022-04-17 6:52:58 41 [Warning] Access denied for user ‘root’@‘localhost’ (using password: NO)
2022-04-17 7:24:11 98 [Warning] Access denied for user ‘root’@‘localhost’ (using password: YES)

I don’t know if the root user exists or if he has the corresponding privileges, or the implications of having made the recommendations of Secure MariaDB:
-Remove anonymous users
-Remove the test database and access to it
-Disallow root login remotely

Hi @Enernorbel ,

We will review that guide, but you can use the WordPress’ credentials to access the database now. You can find those credentials in the /opt/bitnami/wordpress/wp-config.php file

mysql -u bn_wordpress -p bitnami_wordpress

Yes, I had previously accessed the database with the user bn_wordpress but not with the root user.

I can’t access the database with the root user as I was supposed to.

In fact, the root user has been removed as you can see in the screenshot below.
SELECT host, user FROM mysql.user;

Questions:

  1. Is removing the root user the desired behavior when following the instructions to secure the database?
  2. What are the future implications of not having a root user account?
  3. Any recommended way to restore to root user?

Hi @Enernorbel ,

No, it was expected to keep the root user account available just for “localhost” or “127.0.0.1” connections

You won’t be able to create/remove databases or users.

It seems you can restore the root user by following this other post

https://stackoverflow.com/a/6085495

Note: I suggest you create a backup of the instance before “playing” with the database

You can also launch a new Bitnami WordPress instance and migrate the data

https://docs.bitnami.com/google/how-to/migrate-wordpress/

Hi Jota,

Thanks for the help.

I understand the options you have given me.

Anyway, I would appreciate your feedback with any comments you have after reviewing the “Secure MariaDB” guide to avoid that error and in the same way serve to prevent others from having the same problem I had about the root account in the database.

Hi @Enernorbel ,

We just added a warning message to let the users know about this permissions problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.