Skip to content

Cannot migrate a schema.dump file using SSL/TLS with MySQL driver or disable SSL mode in Illuminate/Database/Schema/MySqlSchemaState #57821

@hazratmilad

Description

@hazratmilad

Laravel Version

12.39.3

PHP Version

8.2

Database Driver & Version

MYSQL 8.4.3

Description

When I try to import a schema.dump file into a MySQL database over SSL, I can’t provide the --ssl-cert and --ssl-key options, because the import command only supports --ssl-ca. Also, why is the --ssl=off option commented out?

Steps To Reproduce

laravel/framework/src/Illuminate/Database/Schema/MySqlSchemaState.php line 108


protected function connectionString()
    {
        $value = ' --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}"';

        $config = $this->connection->getConfig();

        $value .= $config['unix_socket'] ?? false
            ? ' --socket="${:LARAVEL_LOAD_SOCKET}"'
            : ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"';

        if (isset($config['options'][\PDO::MYSQL_ATTR_SSL_CA])) {
            $value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"';
        }

//        if (isset($config['options'][\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT]) &&
//            $config['options'][\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] === false) {
//            $value .= ' --ssl=off';
//        }

        return $value;
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions