[GH-ISSUE #68] Can't connect to target database #47

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

Originally created by @makopov on GitHub (Dec 29, 2017).
Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/68

Here is the command I run that generates the above error message:
./dbdiff server1.dev:server2.prod

My .dbcon is setup as such:

server1:
user: root
password:
port: 3306 # for MySQL this is 3306
host: localhost # usually localhost or 127.0.0.1
server2:
user: root
password:
port: 3306 # for MySQL this is 3306
host: localhost # usually localhost or 127.0.0.1
template: templates/simple-db-migrate.tmpl
type: all
include: all
nocomments: true
tablesToIgnore:
-accesslog
-users

This is a test vm and mysql actually has no password set on it so the field is left empty, I'm assuming this isn't the problem?

Its also unclear which of the two databases is the source and which is the target.

Any help would be great.

Originally created by @makopov on GitHub (Dec 29, 2017). Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/68 Here is the command I run that generates the above error message: `./dbdiff server1.dev:server2.prod` My .dbcon is setup as such: > server1: > user: root > password: > port: 3306 # for MySQL this is 3306 > host: localhost # usually localhost or 127.0.0.1 > server2: > user: root > password: > port: 3306 # for MySQL this is 3306 > host: localhost # usually localhost or 127.0.0.1 > template: templates/simple-db-migrate.tmpl > type: all > include: all > nocomments: true > tablesToIgnore: > -accesslog > -users This is a test vm and mysql actually has no password set on it so the field is left empty, I'm assuming this isn't the problem? Its also unclear which of the two databases is the source and which is the target. Any help would be great.
Author
Owner

@mowreyw commented on GitHub (Jan 12, 2018):

I'm also having difficulty connecting to my database using the same parameters which work on the command line. Initially I had some issues with the YAML formatting (which have been resolved), but now I just receive the error message:

✖ Can't connect to target database

I see the same issue when entering the connection parameters at the command line using the flags --server1 and --server2. However, I these parameters work fine when connecting using the mysql command line tool.

<!-- gh-comment-id:357354814 --> @mowreyw commented on GitHub (Jan 12, 2018): I'm also having difficulty connecting to my database using the same parameters which work on the command line. Initially I had some issues with the YAML formatting (which have been resolved), but now I just receive the error message: `✖ Can't connect to target database` I see the same issue when entering the connection parameters at the command line using the flags `--server1` and `--server2`. However, I these parameters work fine when connecting using the mysql command line tool.
Author
Owner

@amansoni commented on GitHub (May 22, 2018):

Had the same issue which was resolved by installing the php-mysql libraries. On Ubuntu sudo apt install php-mysql which resolved to php-mysql7.1

<!-- gh-comment-id:390863713 --> @amansoni commented on GitHub (May 22, 2018): Had the same issue which was resolved by installing the php-mysql libraries. On Ubuntu `sudo apt install php-mysql` which resolved to php-mysql7.1
Author
Owner

@nkagarw commented on GitHub (May 17, 2019):

I'm facing the same issue with php 7.3.5 on Windows 10. How do I install php-mysql dependencies on windows ?

<!-- gh-comment-id:493476391 --> @nkagarw commented on GitHub (May 17, 2019): I'm facing the same issue with php 7.3.5 on Windows 10. How do I install php-mysql dependencies on windows ?
Author
Owner

@rajneesh594 commented on GitHub (May 28, 2020):

Here is the command I run that generates the above error message:
./dbdiff server1.dev:server2.prod

My .dbcon is setup as such:

server1:
user: root
password:
port: 3306 # for MySQL this is 3306
host: localhost # usually localhost or 127.0.0.1
server2:
user: root
password:
port: 3306 # for MySQL this is 3306
host: localhost # usually localhost or 127.0.0.1
template: templates/simple-db-migrate.tmpl
type: all
include: all
nocomments: true
tablesToIgnore:
-accesslog
-users

This is a test vm and mysql actually has no password set on it so the field is left empty, I'm assuming this isn't the problem?

Its also unclear which of the two databases is the source and which is the target.

Any help would be great.

have u solved it ??

<!-- gh-comment-id:635267816 --> @rajneesh594 commented on GitHub (May 28, 2020): > Here is the command I run that generates the above error message: > `./dbdiff server1.dev:server2.prod` > > My .dbcon is setup as such: > > > server1: > > user: root > > password: > > port: 3306 # for MySQL this is 3306 > > host: localhost # usually localhost or 127.0.0.1 > > server2: > > user: root > > password: > > port: 3306 # for MySQL this is 3306 > > host: localhost # usually localhost or 127.0.0.1 > > template: templates/simple-db-migrate.tmpl > > type: all > > include: all > > nocomments: true > > tablesToIgnore: > > -accesslog > > -users > > This is a test vm and mysql actually has no password set on it so the field is left empty, I'm assuming this isn't the problem? > > Its also unclear which of the two databases is the source and which is the target. > > Any help would be great. have u solved it ??
Author
Owner

@trajano commented on GitHub (Sep 14, 2020):

I'm having trouble with this as well on Windows. I created a Dockerfile like this

FROM php
RUN apt-get update && \
    apt-get install -y --no-install-recommends git && \
    docker-php-ext-install mysqli && \
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
    php composer-setup.php && \
    php -r "unlink('composer-setup.php');" && \
    php composer.phar require "dbdiff/dbdiff:@dev" 
COPY .dbdiff .dbdiff
<!-- gh-comment-id:691770144 --> @trajano commented on GitHub (Sep 14, 2020): I'm having trouble with this as well on Windows. I created a Dockerfile like this ``` FROM php RUN apt-get update && \ apt-get install -y --no-install-recommends git && \ docker-php-ext-install mysqli && \ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ php composer-setup.php && \ php -r "unlink('composer-setup.php');" && \ php composer.phar require "dbdiff/dbdiff:@dev" COPY .dbdiff .dbdiff ```
Author
Owner

@shaoxp commented on GitHub (Feb 3, 2021):

i resolved this issue by enable mysql extentions in php.ini

<!-- gh-comment-id:772336163 --> @shaoxp commented on GitHub (Feb 3, 2021): i resolved this issue by enable mysql extentions in php.ini
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#47
No description provided.