[GH-ISSUE #79] Database Names with Hyphens cause the error "Can't connect to target database" #55

Open
opened 2026-02-25 21:33:09 +03:00 by kerem · 2 comments
Owner

Originally created by @iocron on GitHub (Jun 19, 2018).
Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/79

If there are hyphens (-) in the database name, then the error "Can't connect to target database" appears otherwise not. For example: ./dbdiff --output="./migrations/today.sql" server1.my-database1:server2.my-database2

Originally created by @iocron on GitHub (Jun 19, 2018). Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/79 If there are hyphens (-) in the database name, then the error "Can't connect to target database" appears otherwise not. For example: ./dbdiff --output="./migrations/today.sql" server1.my-database1:server2.my-database2
Author
Owner

@IncubuzzCC commented on GitHub (Jul 2, 2018):

I had the same issue and created a fix for this issue.
https://github.com/DBDiff/DBDiff/pull/80
The changes are visible in my fork:
https://github.com/pddm/DBDiff/blob/master/src/DB/Data/LocalTableData.php

<!-- gh-comment-id:401942707 --> @IncubuzzCC commented on GitHub (Jul 2, 2018): I had the same issue and created a fix for this issue. https://github.com/DBDiff/DBDiff/pull/80 The changes are visible in my fork: https://github.com/pddm/DBDiff/blob/master/src/DB/Data/LocalTableData.php
Author
Owner

@IncubuzzCC commented on GitHub (Jul 4, 2020):

There is an improved fix for this issue, which also escapes table names presenting similar issues:
fix(SQL): Escape Database Names
#92 opened on May 19, 2019 by janfa

<!-- gh-comment-id:653798657 --> @IncubuzzCC commented on GitHub (Jul 4, 2020): There is an improved fix for this issue, which also escapes table names presenting similar issues: fix(SQL): Escape Database Names #92 opened on May 19, 2019 by janfa
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/DBDiff#55
No description provided.