View Issue Details

IDProjectCategoryView StatusLast Update
0033519mantisbtinstallationpublic2024-02-20 16:58
Reporteracoder2020 Assigned Todregad  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSRed Hat Enterprise Linux ServerOS Version7.9
Product Version2.26.0 
Target Version2.26.1Fixed in Version2.26.1 
Summary0033519: MySQL Native Driver (mysqlnd) is required
Description

When attempting to install a fresh copy of Mantis using a known good MySQL user/password combination, the installer rejects those same credentials with:

Attempting to connect to database as admin
BAD
Does administrative user have access to the database? ( )

See also discussion in Forums https://mantisbt.org/forums/viewtopic.php?t=29009

Steps To Reproduce

CONFIGURE MYSQL DATABASE AND USER

First, create MySQL database bugtracker.

CREATE DATABASE bugtracker;

Second, create MySQL user with native password type.

Note when using MariaDB, the default mysql_native_password is used when a password type is not specified ( https://mariadb.com/kb/en/authentication-plugin-mysql_native_password/ )

CREATE USER 'mantisuser24'@'localhost' IDENTIFIED BY 'DontHackMeBro';
grant all privileges on bugtracker.* to 'mantisuser24'@'localhost';

FLUSH PRIVILEGES;

INSTALL MANTIS

Download Mantis 2.26.0, extract to a directory on my server and access install.php page via web browser.

Note: Do not edit any config files after unpacking the zip download. Just unzip and run install.php

Enter the following values:

Type of Database: Mysql Improved
Hostname (for Database Server): localhost
Username (for Database): mantisuser24
Password (for Database): DontHackMeBro
Database name (for Database): bugtracker
Admin Username (to create Database if required): mantisuser24
Admin Password (to create Database if required): DontHackMeBro
Database Table Prefix: mantis
Database Plugin Table Prefix: plugin
Database Table Suffix: _table
Default Time Zone: New York
Print SQL Queries instead of Writing to the Database: DO NOT CHECK

Click "Install/Upgrade Database"

This results in error:

Attempting to connect to database as admin
BAD
Does administrative user have access to the database? ( )

Additional Information

I can log in with the same MySQL (actually MariaDB 5.5.68) credentials from command line without any issue.

# mysql -umantisuser24 -pDontHackMeBro
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1285510
Server version: 5.5.68-MariaDB MariaDB Server

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)]> exit
Bye
TagsNo tags attached.
Attached Files

Relationships

related to 0032028 closeddregad Update ADOdb to 5.22.6 

Activities

acoder2020

acoder2020

2024-01-18 13:55

reporter   ~0068450

I tried giving full admin access to the mantisuser24 account used in the installation page, but no difference. Same error.

GRANT ALL PRIVILEGES ON database_name.* TO 'mantisuser24'@'localhost';
FLUSH PRIVILEGES;

Again I can log in with this user account via console/command line with no problems.

Do we have to use ADODB for connecting to MySQL? Can we not use the native PDO connection functions in php instead?

acoder2020

acoder2020

2024-01-18 14:24

reporter   ~0068451

I've also tried installing when the database 'bugtracker' was not created ahead of time. Same error as above.

If the database 'bugtracker' is created ahead of time, same error as above.

acoder2020

acoder2020

2024-01-18 14:33

reporter   ~0068452

Last edited: 2024-01-23 03:44

I copied config_inc.php.sample to config_inc.php

Then edited the connection info as below:

# --- Database Configuration ---
$g_hostname      = 'localhost';
$g_db_username   = 'mantisuser24';
$g_db_password   = 'DontHackMeBro';
$g_database_name = 'bugtracker';
$g_db_type       = 'mysqli';

The installer opens normally, but I continue getting the "Does administrative user have access to the database? ( )" error when clicking Install.

acoder2020

acoder2020

2024-01-19 15:51

reporter   ~0068453

Per forums, I updated MariadDB from 5.5 to 10.4 today:

[code]# mysql -umantisuser24 -pDontHackMeBro
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 25
Server version: 10.4.32-MariaDB MariaDB Server

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)]>
[/code]

Still have the same error on install.php

BAD
Does administrative user have access to the database? ( )

dregad

dregad

2024-01-19 18:45

developer   ~0068454

I tried to reproduce the problem following the given instructions, but couldn't.
With both MariaDB 10.11 and MySQL 8.0.35, database is initialized successfully on my box.

Do we have to use ADODB for connecting to MySQL? Can we not use the native PDO connection functions in php instead?

Yes, ADOdb is mandatory. PDO is not supported.

Does administrative user have access to the database? ( )

Between the parenthesis, I would expect to see an error message returned by the DB, it's strange that there is nothing there.

Could you execute the following low-level commands (which are equivalent to what the install script / ADOdb is doing to connect as Admin before throwing the above error message)

$c = mysqli_init();
mysqli_options($c, MYSQLI_READ_DEFAULT_GROUP, 0);
mysqli_real_connect($c, 'localhost', 'mantisuser24', 'DontHackMeBro', null, 3306, '', 0);
dregad

dregad

2024-01-19 18:56

developer   ~0068455

I Just noticed this message in your screenshot, which is actually not normal output from the install script, but an error returned by ADOdb.

Mantis 2.26.0 bundles ADOdb 5.22.6, which requires requires the MySQL Native Driver (Mysqlnd) to be installed for mysql connections.
Can you check that it is available on your system ?

image.png (34,611 bytes)   
image.png (34,611 bytes)   
atrol

atrol

2024-01-20 02:44

developer   ~0068456

Last edited: 2024-01-20 02:54

@dregad as long as there is no better solution in ADOdb for that than

        // Check for a function that only exists in mysqlnd
        if (!function_exists('mysqli_stmt_get_result')) {
            // @TODO This will be treated as if the mysqli extension were not available
            // This could be misleading, so we output an additional error message.
            // We should probably throw a specific exception instead.
            $this->outp("MySQL Native Driver (msqlnd) required");
            return null;
        }

Shouldn't we introduce an own check for this in the MantisBT installer to prevent such kind of confusion?
And also in the admin checks, to find such issues the easy way if users are getting issues after an upgrade.

dregad

dregad

2024-01-20 17:48

developer   ~0068458

Yeah I must admit this check is kind of crap, as it does not let the client easily catch a meaningful error. As mentioned in the TODO note, it should be replaced with a more severe error or Exception.

Introducing an additional check on our end as a workaround was indeed my intention.

acoder2020

acoder2020

2024-01-23 16:14

reporter   ~0068463

Last edited: 2024-01-23 16:14

mysqlnd is installed:

yum info php72w-mysqlnd
Loaded plugins: etckeeper, product-id, search-disabled-repos, subscription-manager
Installed Packages
Name : php72w-mysqlnd
Arch : x86_64
Version : 7.2.34
Release : 1.w7
Size : 858 k
Repo : installed
From repo : webtatic
Summary : A module for PHP applications that use MySQL databases
URL : http://www.php.net/
License : PHP
Description : The php-mysqlnd package contains a dynamic shared object that will add
: MySQL database support to PHP. MySQL is an object-relational database
: management system. PHP is an HTML-embeddable scripting language. If
: you need MySQL support for PHP applications, you will need to install
: this package and the php package.
:
: This package use the MySQL Native Driver

acoder2020

acoder2020

2024-01-23 16:30

reporter   ~0068464

Last edited: 2024-01-23 16:32

I am able to confirm that the error went away with MariaDB 10.4. When I upgraded MariaDB last week I had a residual error that I thought was a non-issue, but wiped everything out and installed MariaDB 10.4 from scratch.

Will continue setting up Mantis. Thanks all.

dregad

dregad

2024-01-24 02:25

developer   ~0068465

OK, thanks for the feedback and good luck with the installation.

I will keep this open to track the needed improvement to the installer's check, to properly detect the missing extension.

dregad

dregad

2024-01-28 16:21

developer   ~0068477

PR https://github.com/mantisbt/mantisbt/pull/1959 fixes

  • detect mysqlnd in the installer and prevent installation if missing
  • Admin checks also report the problem
  • the requirement has been documented in Admin Guide.

Related Changesets

MantisBT: master-2.26 787eea89

2024-01-20 17:50

dregad


Details Diff
Install: check for missing mysqld and stop if fail

Move database support checks into a separate function to avoid code
duplication.

Add a check for mysqlnd when db_type is mysqli.

Do not attempt to initialize ADOdb object ($g_db) or connect to the
database if the DB checks failed.

Fixes 0033519
Affected Issues
0033519
mod - admin/install.php Diff File

MantisBT: master-2.26 20cb4766

2024-01-20 18:10

dregad


Details Diff
Add admin check for mysqlnd driver

Issue 0033519
Affected Issues
0033519
mod - admin/check/check_database_inc.php Diff File

MantisBT: master-2.26 6fdedc30

2024-01-28 16:02

dregad


Details Diff
Reference mysqlnd in Admin Guide install section

Issue 0033519
Affected Issues
0033519
mod - docbook/Admin_Guide/en-US/Installation.xml Diff File