Change Magento Config to use sockets

my database configuration has changed and Magento can no longer connect. The connection is before work, but now it looks like a socket configuration value is required ...

The relevant part in my local.xml configuration looks like this:

<connection> <host><![CDATA[localhost]]></host> <username><![CDATA[username]]></username> <password><![CDATA[password]]></password> <dbname><![CDATA[dbname]]></dbname> <active>1</active> <model>mysql5</model> <initStatements>SET NAMES utf8</initStatements> <type>pdo_mysql</type> </connection> 

Since Magento uses PDO here, my testcript code can connect:

 $user = 'username'; $pass = 'password'; // PDO Connection try { /* DB CONNECTION */ $pdoMysql = new PDO('mysql:host=localhost;unix_socket=/tmp/mysql5.sock;dbname=dbname', $user, $pass); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } 

So basically I need to add "unix_socket = / tmp / mysql5.sock;" somewhere...

thanks

+4
source share
2 answers

you just put the socket path in the <host/> bit

 <host><![CDATA[/path/to/mysql.sock]]></host> 
+11
source

Change the host as indicated, then remove app/etc/use_cache.ser and try again :)

0
source

All Articles