I've define my own database connection in my Drupal settings file as follow:
$databases['migrate']['default'] = array( 'driver' => 'mysql', 'database' => 'drupal', 'username' => 'root', 'password' => 'root', 'host' => 'localhost', 'prefix' => '', ); To read that in Database object format, you can run:
drush eval 'print_r(Database::getConnectionInfo("default", "migrate"));' And now I would like to have the string representation (similar to $db_url in Drupal 6) to use it in some drush commands on that database e.g. drush --db-url=${DB_URL} status.
So I would like to convert above Database array format into database URL string format (e.g. mysql://root:root@localhost/drupal).
Is there any easy way of doing that via function, PHP code or drush?
Additional info:
- There is update_parse_db_url() function, but it's converting database connection URLs and return D7 compatible array.