Does that user from MaxScale have PROCESS permissions?  That's normally the only reason i've run into that error, but I'm not a MaxScale user, so hopefully it's somewhat helpful.

On Thu, May 9, 2019 at 11:47 AM Nicolas Bigler <nicolas.bigler@vshn.ch> wrote:
Hey community

I'm currently struggling with maxscale when trying to connect to the
information_schema database.

I'm able to connect to this special database when connecting to the
database server directly:


mysql -h <my_db_server> information_schema
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 101189
Server version: 10.2.23-MariaDB-1:10.2.23+maria~bionic-log mariadb.org
binary distribution

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 [information_schema]>



However I can't connect to the database when going through maxscale:

mysql -h 127.0.0.1 information_schema
ERROR 1045 (28000): Access denied for user '<my_user>'@'127.0.0.1'
(using password: YES) to database 'information_schema'


What does work is to connect to the database first (via maxscale)
without specifying a database and then change to the information_schema
database:

mysql -h 127.0.0.1
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 25321
Server version: 10.2.23-MariaDB-1:10.2.23+maria~bionic-log mariadb.org
binary distribution

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)]> use information_schema
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed


I don't quite understand why it doesn't work directly.
I have a PHP application (magento2) that reads stuff from this database.


The following PHP script shows the same issue:

<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'information_schema';
$dbuser = '<my_db_user>';
$dbpass = '<my_super_secret_pass';
$dbhost = '127.0.0.1';

# pdo_testdb_connect.php - function for connecting to the "test" database

$dbh = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname, $dbuser,
$dbpass);

echo $dbh->exec ("SHOW TABLES FROM $dbname");

?>

$ php test.php
PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [1045] Access
denied for user '<my_db_user>'@'127.0.0.1' (using password: YES) to
database 'information_schema' in /tmp/test.php:12
Stack trace:
#0 /tmp/test.php(12): PDO->__construct('mysql:host=127....',
'<my_db_user>', '<my_super_secret_pass>...')
#1 {main}
  thrown in /tmp/test.php on line 12

Is there a way to solve this issue?

Any help would be appreciated.

Thanks

Nicolas

_______________________________________________
Mailing list: https://launchpad.net/~maria-discuss
Post to     : maria-discuss@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-discuss
More help   : https://help.launchpad.net/ListHelp