Can not log into MySQL with root account; "Access denied for user 'root'@'localhost'"

Keywords: WordPress - Virtual Machines - Technical issue - Credentials
bnsupport ID: bf102d17-98ea-1890-84c9-7e40b79fe04e
Description:
both MySQL and myPHPAdmin return “Access denied for user ‘root’@‘localhost’ (using password: YES)”

root account is defined in /opt/bitnami/mysql/my.cnf

I have confirmed the password in ./bitnami_credentials

I have reset the password following: https://docs.bitnami.com/general/apps/wordpress/administration/change-reset-password/

Using the lastest WordPress Single Stack OVA 5.2.2-3 for VMWare.
MySQL version: Ver 8.0.17 for linux-glibc2.12 on x86_64

Hi @dandolsen,

Could you try this approach?

   echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW_PASSWORD';" > /home/bitnami/mysql-init
   sudo /opt/bitnami/ctlscript.sh stop mysql
   sudo /opt/bitnami/mysql/bin/mysqld_safe --pid-file=/opt/bitnami/mysql/data/mysqld.pid --datadir=/opt/bitnami/mysql/data --init-file=/home/bitnami/mysql-init --lower_case_table_names=1 2> /dev/null &
   sudo /opt/bitnami/ctlscript.sh restart mysql
   rm /home/bitnami/mysql-init

I hope it helps

Yes, I tried this.

May have to remove the “2> /dev/null &” and see if the force of the password change is failing.

Hi @dandolsen,

I just tried the steps that @davidg mentioned and everything worked as expected, do you get any error message when running the commands? Is there any error message in the MySQL’s log file?

sudo tail -n30 /opt/bitnami/mysql/data/mysqld.log

Thanks

Here is the log

2019-08-01T16:53:51.799202Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld.bin (mysqld 8.0.17) starting as process 5065
2019-08-01T16:53:51.801225Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-08-01T16:53:51.801235Z 0 [Warning] [MY-013244] [Server] --collation-server: ‘utf8_general_ci’ is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2019-08-01T16:53:52.350944Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-08-01T16:53:52.366973Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld.bin: ready for connections. Version: ‘8.0.17’ socket: ‘/opt/bitnami/mysql/tmp/mysql.sock’ port: 3306 MySQL Community Server - GPL.
2019-08-01T16:53:52.550021Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: ‘/tmp/mysqlx.sock’ bind-address: ‘::’ port: 33060
2019-08-01T17:03:05.931387Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld.bin: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
2019-08-01T17:03:52.326644Z 0 [Warning] [MY-011068] [Server] The syntax ‘expire-logs-days’ is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-08-01T17:03:52.326733Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld.bin (mysqld 8.0.17) starting as process 5910
2019-08-01T17:03:52.328646Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-08-01T17:03:52.328657Z 0 [Warning] [MY-013244] [Server] --collation-server: ‘utf8_general_ci’ is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2019-08-01T17:03:52.846441Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-08-01T17:03:52.862243Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld.bin: ready for connections. Version: ‘8.0.17’ socket: ‘/opt/bitnami/mysql/tmp/mysql.sock’ port: 3306 MySQL Community Server - GPL.
2019-08-01T17:03:53.052875Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: ‘/tmp/mysqlx.sock’ bind-address: ‘::’ port: 33060
2019-08-01T17:05:51.140838Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld.bin: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
2019-08-01T17:08:03.876890Z 0 [Warning] [MY-011068] [Server] The syntax ‘expire-logs-days’ is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-08-01T17:08:03.876980Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld.bin (mysqld 8.0.17) starting as process 6715
2019-08-01T17:08:03.878854Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-08-01T17:08:03.878864Z 0 [Warning] [MY-013244] [Server] --collation-server: ‘utf8_general_ci’ is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2019-08-01T17:08:04.436493Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-08-01T17:08:04.452203Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld.bin: ready for connections. Version: ‘8.0.17’ socket: ‘/opt/bitnami/mysql/tmp/mysql.sock’ port: 3306 MySQL Community Server - GPL.
2019-08-01T17:08:04.635118Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: ‘/tmp/mysqlx.sock’ bind-address: ‘::’ port: 33060
2019-08-05T14:40:05.030570Z 0 [System] [MY-010910] [Server] /opt/bitnami/mysql/bin/mysqld.bin: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
2019-08-05T14:44:10.679026Z 0 [Warning] [MY-011068] [Server] The syntax ‘expire-logs-days’ is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-08-05T14:44:10.679109Z 0 [System] [MY-010116] [Server] /opt/bitnami/mysql/bin/mysqld.bin (mysqld 8.0.17) starting as process 11577
2019-08-05T14:44:10.681105Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-08-05T14:44:10.681115Z 0 [Warning] [MY-013244] [Server] --collation-server: ‘utf8_general_ci’ is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
2019-08-05T14:44:11.205454Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-08-05T14:44:11.221140Z 0 [System] [MY-010931] [Server] /opt/bitnami/mysql/bin/mysqld.bin: ready for connections. Version: ‘8.0.17’ socket: ‘/opt/bitnami/mysql/tmp/mysql.sock’ port: 3306 MySQL Community Server - GPL.
2019-08-05T14:44:11.412701Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: ‘/tmp/mysqlx.sock’ bind-address: ‘::’ port: 33060

Hi @dandolsen,

I don’t see anything wrong in those lines. Let’s try to obtain more information

echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'bitnami';" > /home/bitnami/mysql-init
sudo /opt/bitnami/ctlscript.sh stop mysql
sudo /opt/bitnami/mysql/bin/mysqld_safe --pid-file=/opt/bitnami/mysql/data/mysqld.pid --datadir=/opt/bitnami/mysql/data --init-file=/home/bitnami/mysql-init --lower_case_table_names=1 > /tmp/mysql_init_output 2>&1 &
sudo /opt/bitnami/ctlscript.sh restart mysql
rm /home/bitnami/mysql-init

These commands are similar to the ones that @david shared but I modified the mysql init command to redirect the output to a file, can you get the information from it?

sudo cat /tmp/mysql_init_output

My file looks like this

$ cat /tmp/mysql_init_output
2019-08-12T09:32:14.952510Z mysqld_safe Logging to '/opt/bitnami/mysql/data/bitnami-wordpress-dm-f73a.err'.
2019-08-12T09:32:14.973337Z mysqld_safe Starting mysqld daemon with databases from /opt/bitnami/mysql/data
2019-08-12T09:32:25.455148Z mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/mysqld.pid ended

That file mentions another .err file, can you open that one as well?

sudo cat /opt/bitnami...

It’d be great if you can try to access the database again

which mysql
mysql -u root -pbitnami

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