Classes/Console/Command/DatabaseCommandController.php
public function importCommand($interactive = false, string $connection = 'Default')
    {
        $availableConnectionNames = $this->connectionConfiguration->getAvailableConnectionNames('mysql');
        if (empty($availableConnectionNames) || !in_array($connection, $availableConnectionNames, true)) {
            $this->output('<error>No suitable MySQL connection found for import.</error>');
            $this->quit(2);
        }

        $mysqlCommand = new MysqlCommand($this->connectionConfiguration->build($connection), [], $this->output->getSymfonyConsoleOutput());
        $exitCode = $mysqlCommand->mysql(
            $interactive ? [] : ['--skip-column-names'],
            STDIN,
            null,
            $interactive
        );
        $this->quit($exitCode);
    }
public function importCommand($interactive = false, string $connection = 'Default')
    {
        $availableConnectionNames = $this->connectionConfiguration->getAvailableConnectionNames('mysql');
        if (empty($availableConnectionNames) || !in_array($connection, $availableConnectionNames, true)) {
            $this->output('<error>No suitable MySQL connection found for import.</error>');
            $this->quit(2);
        }

        $mysqlCommand = new MysqlCommand($this->connectionConfiguration->build($connection), [], $this->output->getSymfonyConsoleOutput());
        $exitCode = $mysqlCommand->mysql(
            $interactive ? [] : ['--skip-column-names'],
            STDIN,
            null,
            $interactive
        );
        $this->quit($exitCode);
    }
Import mysql queries from stdin

This means that this can not only be used to pass insert statements,
it but works as well to pass SELECT statements to it.
The mysql binary must be available in the path for this command to work.
This obviously only works when MySQL is used as DBMS.

<b>Example (import):</b> <code>ssh remote.server '/path/to/typo3cms database:export' | %command.full_name%</code>
<b>Example (select):</b> <code>echo 'SELECT username from be_users WHERE admin=1;' | %command.full_name%</code>
<b>Example (interactive):</b> <code>%command.full_name% --interactive</code>

@param bool $interactive Open an interactive mysql shell using the TYPO3 connection settings.
@param string $connection TYPO3 database connection name
@throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException