MyBB Community Forums

Full Version: Installation fails while connecting to Mysql8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I am trying to install Mybb_1.8.21 on my CentOS 7 server, with PHP 7.3 and Mysql 8, but I am stuck at database creation because the connection to the local mysql instance fails (see attached picture). Yet i can login from command line:

[root@web_develop mybb]# mysqladmin -h localhost --port=3306 version -u mybb -p
Enter password:
mysqladmin  Ver 8.0.18 for Linux on x86_64 (MySQL Community Server - GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          8.0.18
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 16 min 8 sec

Threads: 2  Questions: 11  Slow queries: 0  Opens: 115  Flush tables: 3  Open tables: 35  Queries per second avg: 0.011

and also permissions seem to be ok:

mysql> SHOW GRANTS FOR mybb@localhost;
+--------------------------------------------------------------------------------------------------------+
| Grants for mybb@localhost                                                                              |
+--------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `mybb`@`localhost`                                                               |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `prova`.* TO `mybb`@`localhost`           |
+--------------------------------------------------------------------------------------------------------+

What can be the issue ?
Thanks for any help and bye,
  Dk

Can you try to do the same with 127.0.0.1 (creating the user 'mybb'@'127.0.0.1' and granting him) ?
Hi Crazycat,
yes I did it but with the same result, pointing to both localhost and to 127.0.0.1 (see attach).
I also opened on the firewall the mysql service, even if on localhost it should not be necessary...

mysql> SHOW GRANTS FOR [email protected];
+----------------------------------------------------------------------------------------------+
| Grants for [email protected]                                                                    |
+----------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `mybb`@`127.0.0.1`                                                     |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `prova`.* TO `mybb`@`127.0.0.1` |
+----------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

PS: in /etc/my.cnf the bind-address is set to: bind-address = 127.0.0.1, but I tried also the host IP address, without success.
That's weird.
Can you have a look to phpinfo ? And can you create a small php script to check the connection to database ?
Problem solved !  Cool

Following your suggestion, I wrote a simple connection script using mysqli, and I discovered the following server error from /var/log/httpd/error_log:

[Mon Oct 21 15:21:10.834722 2019] [php7:warn] [pid 9446] [client 10.230.13.22:44976] PHP Warning:  mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /var/www/html/db.php on line 16
[Mon Oct 21 15:21:10.834763 2019] [php7:warn] [pid 9446] [client 10.230.13.22:44976] PHP Warning:  mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in /var/www/html/db.php on line 16

After a little search I found that the solution could be changing the password of the mysql user with the SQL command:

ALTER USER 'mybb'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

And it magically worked !
Thanks and bye,
  Dk
Thanks for having shared the solution Smile