Hi,

I am trying to use the mysqlnd_ms plugin on my php installation but when I run any code trying to utilise the "myapp" variable I have set up as per the tutorial it just gives the error:

PHP Warning:  mysql_connect(): Unknown MySQL server host 'myapp' (1) in /var/www/settings/database.php on line 10

database.php line 10 looks like this

    $success = mysql_connect ("myapp", $mysql_user, $mysql_password);

The mysqlnd_ms php.ini config

extension=mysqlnd_ms.so
mysqlnd_ms.enable=1
mysqlnd_ms.force_config_usage = 1
mysqlnd_ms.config_file=/etc/mysqlnd_ms_plugin.ini
mysqlnd_ms.multi_master=1
mysqlnd_ms.disable_rw_split=1

and finally mysqlnd_ms_plugin.ini...

{
 "myapp": {
  "master": {
   "master_0":{"host":"192.168.1.202"},
   "master_1":{"host":"192.168.1.203"}
  },
  "slave":{
  },
  "filters":{
   "roundrobin":[]
  }
 }
}

However, it doesn't work. What could be up?

James.

Member Avatar
LastMitch

@jamesl22

I am trying to use the mysqlnd_ms plugin on my php installation but when I run any code trying to utilise the "myapp" variable I have set up as per the tutorial it just gives the error:

Read this:

Example #1 Provoking a connection error

Example #2 Connection error on query execution

http://php.net/manual/en/mysqlnd-ms.errorhandling.php

This doesn't really answer my question I think. The problem is that myapp is not recognised by the pho code, not that it can't actually connect to the server.

Member Avatar
LastMitch

@jamesl22

This doesn't really answer my question I think. The problem is that myapp is not recognised by the pho code, not that it can't actually connect to the server.

PHP Warning: mysql_connect(): Unknown MySQL server host 'myapp' (1) in /var/www/settings/database.php on line 10

database.php line 10 looks like this

$success = mysql_connect ("myapp", $mysql_user, $mysql_password);

The issue is that your connection is not working. If that was not the issue then line 10 wouldn't appear since it tells you there's something wrong with the connection than there is something wrong with your connection.

This function: mysql_connect

Read this about it:

http://de3.php.net/manual/en/function.mysql-connect.php

I would suggested to used MYSQLI or PDO

appreciate if somebody can share some success factory with implementation of this plugin and high availability is maintained during failover from master to slave.. kindly share your experiences