[wp-trac] [WordPress Trac] #41722: wpdb::db_connect() does not connect to IPv6 address of mysql server

WordPress Trac noreply at wordpress.org
Thu Aug 24 17:31:53 UTC 2017


#41722: wpdb::db_connect() does not connect to IPv6 address of mysql server
--------------------------+-----------------------------
 Reporter:  fierevere     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  4.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 There is currently no way to make WordPress to connect to MySQL server
 using IPv6 address

 {{{#!php
 <?php
 define('DB_HOST', '::1');
 }}}

 Error establishing a database connection

 in brackets:

 {{{#!php
 <?php
 define('DB_HOST', '[::1]');
 }}}

 Error establishing a database connection


 the only way it works by defining a hostname in /etc/hosts and then
 connecting to it, but its not available option on shared hosting when you
 dont have control over files in /etc/

 quoting @sergeybiryukov :


 {{{
 wpdb::db_connect() appears to treat everything after : as a port or
 socket:
 https://core.trac.wordpress.org/browser/tags/4.8.1/src/wp-includes/wp-
 db.php?marks=1517-1535#L1504

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41722>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list