My database can't connect.
My database can't connect.
root@panel:~# keyhelp-toolbox
Warning: MySQL - Connection Error: Access denied for user 'keyhelp'@'localhost' to database 'keyhelp' in /home/keyhelp/www/keyhelp/core-old/pending/DBConnection.php on line 338
Fatal error: Uncaught Error: Call to a member function query() on null in /home/keyhelp/www/keyhelp/core-old/pending/DBConnection.php:114
Stack trace:
#0 /home/keyhelp/www/keyhelp/core-old/pending/DBConnection.php(65): DBConnection->connect()
#1 /home/keyhelp/www/keyhelp/core-old/pending/DBConnection.php(374): DBConnection->__construct()
#2 /home/keyhelp/www/keyhelp/bin/keyhelp_toolbox.php(35): DBConnection::getConnection()
#3 {main}
thrown in /home/keyhelp/www/keyhelp/core-old/pending/DBConnection.php on line 114
How to fix it?
Re: My database can't connect.
root@panel:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 329
Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04
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 WHERE user = 'keyhelp';
+---------+-----------+
| User | Host |
+---------+-----------+
| keyhelp | localhost |
+---------+-----------+
1 row in set (0.001 sec)
MariaDB [(none)]> SHOW GRANTS FOR 'keyhelp'@'localhost';
+----------------------------------------------------------------------------------------------------------------+
| Grants for keyhelp@localhost |
+----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `keyhelp`@`localhost` IDENTIFIED BY PASSWORD '*4C5CB14A67713E8C5ED26B7DF1033C08D9A7B095' |
+----------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keyhelp.* TO 'keyhelp'@'localhost' IDENTIFIED BY 'passowrd';
Query OK, 0 rows affected (0.074 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit
Bye
It's can fix it.But why?
Re: My database can't connect.
Webmail will got error message.
Oops... something went wrong!
An internal error has occurred. Your request cannot be processed at this time.
For administrators: Please check the application and/or server error logs for more information
How to fix it?
Re: My database can't connect.
What have you done to your server?
You have to make sure that the passwords in these files:
KeyHelp password:
/etc/keyhelp/config/config.json
/home/keyhelp/www/roundcube/plugins/password/config.inc.php
/etc/proftpd/sql.conf
/etc/postfix/mysql-virtual-*
/etc/dovecot/dovecot-sql.conf
/etc/amavis/conf.d/50-user (Depending on your OS, if you have that file)
Roundcube password:
/home/keyhelp/www/roundcube/config/config.inc.php
SnappyMail password:
/home/keyhelp/www/snappymail/data/_data_/_default_/configs/application.ini
PhpMyAdmin password:
/home/keyhelp/www/phpmyadmin/config.inc.php
Are in sync with the database users:
keyhelp,
keyhelp_root,
roundcube,
snappymail,
phpmyadmin
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Re: My database can't connect.
1. I use this command
mysql -u root -p and not input any password.It's can login mysql.Why?
I also check another keyhelp server.It's the same not need input any password.
2. I use GRANT ALL PRIVILEGES ON keyhelp.* TO 'keyhelp'@'localhost' IDENTIFIED BY 'passowrd'; this command to fix.
Is this right solution?
3 I fix webmail use follow command.
GRANT ALL PRIVILEGES ON roundcube.* TO 'roundcube'@'localhost';
Is this right solution?
Thanks a lot.
Re: My database can't connect.
This is a default behaviour of your operating system + MariaDB/MySQL that was introduced around the time Ubuntu 16/Ubuntu 18 were released. This has nothing to do with KeyHelp.1. I use this command
mysql -u root -p and not input any password.It's can login mysql.Why?
I also check another keyhelp server.It's the same not need input any password.
It allows you to log into the database without a password if you are logged into the server as root.
For the "keyhelp" user:2. I use GRANT ALL PRIVILEGES ON keyhelp.* TO 'keyhelp'@'localhost' IDENTIFIED BY 'passowrd'; this command to fix.
Is this right solution?
Code: Select all
GRANT ALL PRIVILEGES ON keyhelp.* TO 'keyhelp'@'localhost' IDENTIFIED BY "..."
Code: Select all
GRANT ALL PRIVILEGES ON *.* TO 'keyhelp_root'@'localhost' IDENTIFIED BY "..." WITH GRANT OPTION
An "IDENTIFIED BY '....'" is missing, but other than that, yes, this is correct.3 I fix webmail use follow command.
GRANT ALL PRIVILEGES ON roundcube.* TO 'roundcube'@'localhost';
Is this right solution?
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************