xsist10/cadfael

Invalid schema specified: information_schema

Closed this issue · 3 comments

running the tool against mysql 8.0.30-0ubuntu0.20.04.2 I am running into this error:

$ vendor/bin/cadfael run --host mysql80.ab --username testuser --port 3306 mydb -vvv

Cadfael CLI Tool

Host: mysql80.ab:3306
User: testuser

What is the database password?

[2022-09-14T16:17:13.612721+00:00] name.INFO: Collecting MySQL VARIABLES. [] []
[2022-09-14T16:17:13.633567+00:00] name.INFO: Collecting MySQL GLOBAL STATUS. [] []
[2022-09-14T16:17:13.636969+00:00] name.INFO: Collecting GRANTs. [] []
[2022-09-14T16:17:13.638765+00:00] name.INFO: Checking for permission to access mysql.SCHEMA_PRIVILEGES. [] []
[2022-09-14T16:17:13.638889+00:00] name.INFO: Collecting MySQL user accounts. [] []
[2022-09-14T16:17:13.641175+00:00] name.INFO: Collecting all table names in database. [] []
[2022-09-14T16:17:13.654122+00:00] name.INFO: Checking for permission to access information_schema.innodb_tablespaces. [] []
[2022-09-14T16:17:13.654328+00:00] name.INFO: Collecting MySQL tablespaces from information_schema.innodb_tablespaces. [] []
[2022-09-14T16:17:13.691405+00:00] name.INFO: Checking for permission to access information_schema.innodb_sys_tablespaces. [] []
[2022-09-14T16:17:13.691680+00:00] name.INFO: Checking for permission to access information_schema.TABLES. [] []
[2022-09-14T16:17:13.691815+00:00] name.INFO: Checking for permission to access information_schema.COLUMNS. [] []
[2022-09-14T16:17:13.691913+00:00] name.INFO: Checking for permission to access information_schema.STATISTICS. [] []
[2022-09-14T16:17:13.692016+00:00] name.INFO: Checking for permission to access mydb.?. [] []
[2022-09-14T16:17:13.692614+00:00] name.INFO: Collecting information_schema.TABLES. [] []
[2022-09-14T16:17:13.700318+00:00] name.INFO: Collecting information_schema.COLUMNS. [] []
[2022-09-14T16:17:13.723562+00:00] name.INFO: Collecting information_schema.STATISTICS. [] []
[2022-09-14T16:17:13.733909+00:00] name.INFO: Collecting schemas. [] []
[2022-09-14T16:17:13.735840+00:00] name.INFO: Checking for permission to access sys.schema_auto_increment_columns. [] []
[2022-09-14T16:17:13.735952+00:00] name.INFO: Collecting sys.schema_auto_increment_columns. [] []
[2022-09-14T16:17:13.747667+00:00] name.INFO: Checking for permission to access sys.schema_index_statistics. [] []
[2022-09-14T16:17:13.747792+00:00] name.INFO: Collecting sys.schema_index_statistics. [] []
[2022-09-14T16:17:14.179659+00:00] name.INFO: Checking for permission to access mysql.innodb_index_stats. [] []
[2022-09-14T16:17:14.179798+00:00] name.INFO: Collecting mysql.innodb_index_stats. [] []
[2022-09-14T16:17:14.182407+00:00] name.INFO: Constructing indexes. [] []
[2022-09-14T16:17:14.183191+00:00] name.INFO: Checking for permission to access sys.schema_redundant_indexes. [] []
[2022-09-14T16:17:14.183318+00:00] name.INFO: Collecting sys.schema_redundant_indexes. [] []
[2022-09-14T16:17:14.361977+00:00] name.INFO: Checking for permission to access information_schema.innodb_tables. [] []
[2022-09-14T16:17:14.362173+00:00] name.INFO: Checking for permission to access information_schema.innodb_sys_tables. [] []
[2022-09-14T16:17:14.362267+00:00] name.INFO: Checking for permission to access performance_schema.?. [] []

In Database.php line 247:
 Cadfael\Engine\Factory->buildDatabase() at C:\dvl\Workspace\cadfael\vendor\cadfael\cadfael\src\Cli\Command\RunCommand.php:146
 Cadfael\Cli\Command\RunCommand->runChecksAgainstSchema() at C:\dvl\Workspace\cadfael\vendor\cadfael\cadfael\src\Cli\Command\RunCommand.php:272
 Cadfael\Cli\Command\RunCommand->processSchemas() at C:\dvl\Workspace\cadfael\vendor\cadfael\cadfael\src\Cli\Command\RunCommand.php:299
 Cadfael\Cli\Command\RunCommand->execute() at C:\dvl\Workspace\cadfael\vendor\symfony\console\Command\Command.php:298
 Symfony\Component\Console\Command\Command->run() at C:\dvl\Workspace\cadfael\vendor\symfony\console\Application.php:1028
 Symfony\Component\Console\Application->doRunCommand() at C:\dvl\Workspace\cadfael\vendor\symfony\console\Application.php:299
 Symfony\Component\Console\Application->doRun() at C:\dvl\Workspace\cadfael\vendor\symfony\console\Application.php:171
 Symfony\Component\Console\Application->run() at C:\dvl\Workspace\cadfael\vendor\cadfael\cadfael\bin\cadfael:19
 include() at C:\dvl\Workspace\cadfael\vendor\bin\cadfael:120

run [--host HOST] [-p|--port PORT] [-u|--username USERNAME] [-s|--secret SECRET] [-ps|--performance_schema] [-o|--output-format OUTPUT-FORMAT] [--] <schema>...

tested on eda93c3

running on a windows box

 php -v
PHP 8.0.15 (cli) (built: Jan 18 2022 13:43:14) ( NTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.15, Copyright (c) Zend Technologies

I'm not sure if this is failing on the information_schema calls since the logs do mention permissions and collection of data working without a failure.

INFO: Checking for permission to access information_schema.TABLES. [] []
INFO: Checking for permission to access information_schema.COLUMNS. [] []
INFO: Checking for permission to access information_schema.STATISTICS. [] []
INFO: Checking for permission to access mydb.?. [] []
INFO: Collecting information_schema.TABLES. [] []
INFO: Collecting information_schema.COLUMNS. [] []
INFO: Collecting information_schema.STATISTICS. [] []
INFO: Collecting schemas. [] []

I think this is also related to some buggy code when dealing with more than one schema at a time and the performance_schema queries where a query might access a schema that we haven't cached. I think I have an idea of how to fix that.

For now, a quick fix is to try run it against one schema at a time while I get a full fix ready.

@staabm ping about this issue.

seems fixed, thank you!