• firsthour

    (@firsthour)


    I would like to import from my Drupal 6 DB which I connect to using a mysql socket. (I don’t have any other means to connect)

    In wp-config.php I connect like this:

    define('DB_HOST', 'localhost:/path/to/my/mysql/socket');

    I tried setting that as my hostname in the plugin but was not able to connect. I left the port at 3306 and also tried blanking it out. My database name, username, and password are correct.

    The error I get is:

    [ERROR] Couldn’t connect to the Drupal database. Please check your parameters. And be sure the WordPress server can access the Drupal database.

    SQLSTATE[HY000] [2002] Connection refused

    Thanks for your help, I tried out Drupal 8 and am sorta disappointed in it and am interested in trying out WordPress more and would likely buy your plugin if I decided to go this route.

Viewing 1 replies (of 1 total)
  • Thread Starter firsthour

    (@firsthour)

    I was able to hack in a fix by editing one line in class-fg-drupal-to-wp-admin.php, line 495.

    case 'mysql':
      // MySQL
      $drupal_db = new PDO('mysql:unix_socket=' . $this->plugin_options['hostname'] . ';port=' . $this->plugin_options['port'] . ';dbname=' . $this->plugin_options['database'], $this->plugin_options['username'], $this->plugin_options['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
      break;

    I changed the host param to unix_socket, I’m then able to type in /my/path/to/my/mysql/socket for the hostname in the UI and connect.

Viewing 1 replies (of 1 total)
  • The topic ‘Connect to mysql socket’ is closed to new replies.