Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #22477

Re: importare database mysql dentro un contenitore (docker)

From Alessandro Pellizzari <shuriken@amiran.it>
Newsgroups it.comp.www.php
Subject Re: importare database mysql dentro un contenitore (docker)
Date 2019-01-07 15:29 +0000
Message-ID <g9h9i0F9t0rU1@mid.individual.net> (permalink)
References <q0vlro$omj$1@gioia.aioe.org>

Show all headers | View raw


On 07/01/2019 13:57, sky winter wrote:

> $pdo = new pdo(
>      "mysql:host=localhost;dbname=test",
>      'root','root1'
> );

> Perchè non funziona?

Se usi "localhost" su un client MySQL (incluso PDO), lui cerca di 
connettersi alla Unix socket che, essendo in un container diverso, non è 
accessibile.

Devi usare "mysql" (il nome che hai dato al container, che viene esposto 
dal DNS fittizio di Docker) o 127.0.0.1 per forzarlo a usare la rete.

Devi anche assicurarti che il container MySQL abbia la rete abilitata 
(bind-address=0.0.0.0), ma dovrebbe essere così di default (altrimenti 
non potresti usarlo... :D )

Bye.

Back to it.comp.www.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

importare database mysql dentro un contenitore (docker) sky winter <sky@bo.bo> - 2019-01-07 14:57 +0100
  Re: importare database mysql dentro un contenitore (docker) Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-07 15:29 +0000
    Re: importare database mysql dentro un contenitore (docker) sky winter <sky@bo.bo> - 2019-01-07 17:49 +0100
      Re: importare database mysql dentro un contenitore (docker) Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-08 10:42 +0000
        Re: importare database mysql dentro un contenitore (docker) sky winter <sky@bo.bo> - 2019-01-08 13:34 +0100
          Re: importare database mysql dentro un contenitore (docker) Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-08 13:25 +0000
            Re: importare database mysql dentro un contenitore (docker) sky winter <sky@bo.bo> - 2019-01-08 15:16 +0100
              Re: importare database mysql dentro un contenitore (docker) Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-12 09:58 +0000
                Re: importare database mysql dentro un contenitore (docker) sky winter <sky@bo.bo> - 2019-01-12 19:23 +0100
                Re: importare database mysql dentro un contenitore (docker) Alessandro Pellizzari <shuriken@amiran.it> - 2019-01-12 19:50 +0000
                Re: importare database mysql dentro un contenitore (docker) sky winter <sky@bo.bo> - 2019-01-13 10:36 +0100

csiph-web