php - CodeIgniter: Connecting two mysql instances -


I want to use two database instances in my CodeIgniter application. I have installed DB1 and DB2 in the application but it always uses the first database socket.

  $ this-> Db2 = $ this- & gt; Load-> Database ('D2', TRUE); Message: mysqli :: real_connect (): (HY000 / 2002): not connected via local MySQL server via socket '/var/run/mysqld/mysqld.sock' (2)  

But the second server runs on '/var/run/mysqld/mysqld2.sock', I do not know where it is to use another socket.

Please note that even though I still have the first database, I need to merge two replicas, so setting up the defalut socket in php.ini is not an option.

To add additional settings, you also need to edit your database configuration file. Example:

$ db ['default'] ['hostname'] = 'localhost'; .. $ db ['second_db'] ['hostname'] = 'localhost';

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -