Sarjuuk / aowow

Database viewer for TrinityCore based on aowow by @LordJZ, based on the JS-Engine of Wowhead
204 stars 217 forks source link

PHP Fatal error: Uncaught mysqli_sql_exception: Access denied for user...... #410

Closed Krutok closed 4 months ago

Krutok commented 4 months ago

A database connection with your script is not possible because your tool is probably buggy. It's not my server's fault because I have installed a test script with a test to establish the database connection

php aowow --setup
PHP Fatal error:  Uncaught mysqli_sql_exception: Access denied for user 'woltk'@'localhost' (using password: YES) in /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php:59
Stack trace:
#0 /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php(59): mysqli_connect()
#1 /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Generic.php(116): DbSimple_Mysqli->__construct()
#2 /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php(31): DbSimple_Generic::connect()
#3 /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php(136): DB::connect()
#4 /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php(177): DB::safeGetDB()
#5 /var/www/vhosts/XXX/XXX/aowow/includes/kernel.php(98): DB::Aowow()
#6 /var/www/vhosts/XXX/XXX/aowow/includes/kernel.php(137): loadConfig()
#7 /var/www/vhosts/XXX/XXX/aowow/includes/shared.php(24): require_once('...')
#8 /var/www/vhosts/XXX/XXX/aowow/aowow(3): require('...')
#9 {main}
  thrown in /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php on line 59

Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'woltk'@'localhost' (using password: YES) in /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php:59
Stack trace:
#0 /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php(59): mysqli_connect()
#1 /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Generic.php(116): DbSimple_Mysqli->__construct()
#2 /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php(31): DbSimple_Generic::connect()
#3 /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php(136): DB::connect()
#4 /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php(177): DB::safeGetDB()
#5 /var/www/vhosts/XXX/XXX/aowow/includes/kernel.php(98): DB::Aowow()
#6 /var/www/vhosts/XXX/XXX/aowow/includes/kernel.php(137): loadConfig()
#7 /var/www/vhosts/XXX/XXX/aowow/includes/shared.php(24): require_once('...')
#8 /var/www/vhosts/XXX/XXX/aowow/aowow(3): require('...')
#9 {main}
  thrown in /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php on line 59

Testscript:

<?php
error_reporting(E_ALL);

define ( 'MYSQL_HOST',      'localhost' );
define ( 'MYSQL_BENUTZER',  'myuser' );
define ( 'MYSQL_KENNWORT',  'mypassword' );
define ( 'MYSQL_DATENBANK', 'aowow' );

$db_link = mysqli_connect (MYSQL_HOST,
                           MYSQL_BENUTZER,
                           MYSQL_KENNWORT,
                           MYSQL_DATENBANK);

if ( $db_link )
{
    echo 'Connection successfull';
    print_r( $db_link);
}
else
{
    die('No connection possible: ' . mysqli_error());
}
?>

Screenshot 2024-05-07 121452

As you can see the database connection works with my test phpscript, but with your tool I can't get a database connection

OS: Debian 12 PHP Version: 8.3.6 MySQL Server: MariaDB 10.11

Sarjuuk commented 4 months ago

'woltk'@'localhost' wrath of lich the king

... sicher..?

Krutok commented 4 months ago

'woltk'@'localhost' wrath of lich the king

... sicher..?

Yes very safe and "woltk" is the database username I use the TC WoltK 3.3.5 core

TrinityCore rev. cb0104ca2988+ 2024-05-05 20:05:15 +0200 (release branch) (Unix, RelWithDebInfo, Static)

Had to switch to Debian 12 to be able to compile the last update The Last Update require Debian 12

I can successfully execute the test script under the shell. It contains the same access data as I use for your Aowow. You could also provide me with such a test script to test the database connection, but my script is simple and therefore meaningful enough that the problem is not my fault.

PHP 8.3.6 (cli) (built: Apr 12 2024 12:51:02) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
Sarjuuk commented 4 months ago

'woltk'@'localhost' wrath of lich the king ... sicher..?

Yes very safe and "woltk" is the database username I use the TC WoltK 3.3.5 core

woltk

...ganz sicher..?

Krutok commented 4 months ago

Is this supposed to be a joke?

Screenshot 2024-05-07 140133

iTob191 commented 4 months ago

Is this supposed to be a joke?

Your SQL username is woltk but the correct abbreviation for "Wrath of the Lich King" is wotlk. This might be the spelling mistake that causes your problem.

Krutok commented 4 months ago

Your SQL username is woltk but the correct abbreviation for "Wrath of the Lich King" is wotlk. This might be the spelling mistake that causes your problem.

No, it can't because my test script runs the same way and establishes the database connection.

Here are both scripts as a screenshot, they contain the same username

Screenshot 2024-05-07 144803 Screenshot 2024-05-07 145006

Screenshot 2024-05-07 145602

iTob191 commented 4 months ago

0 /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php(59): mysqli_connect()

In the current version of aowow there is no mysqli_connect() call on that line. See https://github.com/Sarjuuk/aowow/blob/937bec3d84cefdcd0b79af65904dd201cd910eee/includes/libs/DbSimple/Mysqli.php#L59 Can you try updating?

Sarjuuk commented 4 months ago

So you really have an egregious typo in your mysql username and can't be arsed to say: "yes, i have an egregious typo in my mysql username."

does your password contain chars that would be changed by urlencode()

Krutok commented 4 months ago

0 /var/www/vhosts/XXX/XXX/aowow/includes/libs/DbSimple/Mysqli.php(59): mysqli_connect()

In the current version of aowow there is no mysqli_connect() call on that line. See

https://github.com/Sarjuuk/aowow/blob/937bec3d84cefdcd0b79af65904dd201cd910eee/includes/libs/DbSimple/Mysqli.php#L59 Can you try updating?

@iTob191

I've now downloaded the latest version, but the error remains. No connection


13:37:30  [ERR]   E_USER_ERROR - Access denied for user 'woltk'@'localhost' (using password: YES) at /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php line 30 @ /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php:89
13:37:30  [ERR]   E_USER_ERROR - Access denied for user 'woltk'@'localhost' (using password: YES) at /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php line 30 @ /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php:89
13:37:30  [ERR]   E_USER_ERROR - Access denied for user 'woltk'@'localhost' (using password: YES) at /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php line 30 @ /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php:89
13:37:30  [ERR]   E_USER_ERROR - Access denied for user 'woltk'@'localhost' (using password: YES) at /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php line 30 @ /var/www/vhosts/XXX/XXX/aowow/includes/database.class.php:89

https://github.com/Sarjuuk/aowow/blob/937bec3d84cefdcd0b79af65904dd201cd910eee/includes/database.class.php#L30

Krutok commented 4 months ago

So you really have an egregious typo in your mysql username and can't be arsed to say: "yes, i have an egregious typo in my mysql username."

does your password contain chars that would be changed by urlencode()

Yes, numbers, letters and special characters like a password should be.

Sarjuuk commented 4 months ago

not all special chars would trigger urlencode. Be more speciffic or just remove the function call for yourself.

https://github.com/Sarjuuk/aowow/blob/master/includes/database.class.php#L21

Krutok commented 4 months ago

not all special chars would trigger urlencode. Be more speciffic or just remove the function call for yourself.

https://github.com/Sarjuuk/aowow/blob/master/includes/database.class.php#L21

i use letters, numbers and as special character !!

Krutok commented 4 months ago

Ok, I have now generated a different password for the user without special characters. The database connection can now be established.

There may be a note in the overview in the instructions that problems can occur with special characters

Sarjuuk commented 4 months ago

I pointed you at the probable cause of your issues and instead of confirming whether urlencode is the issue you chose to use an insecure password.

Yeah, i'm done.