Database connections - Editor

Database connections - Editor

RobGordonRobGordon Posts: 1Questions: 0Answers: 0
edited April 2014 in Plug-ins
I've just downloaded the Editor plugin, and I'm trying to setup my database connection and failing to connect!!!!

* Edit the following with your database connection options
$sql_details = array(
"type" => "Mysql",
"user" => "root",
"pass" => "*******",
"host" => "localhost",
"port" => "3306",
"db" => "lar"

Here are 2 working connections from existing applications where I've successfully connected to the same mysql database

1) using PDO

define("DBmysql", "mysql:unix_socket=/tmp/mysql.sock;dbname=lar");
define("DBusername", "root");
define("DBpassword", "********");

#connecting to the database by supplying required parameters
$db = new PDO(DBmysql , DBusername, DBpassword);

and 2) using mysqli

define("DB_HOST", "localhost");
define("DB_NAME", "lar");
define("DB_USER", "root");
define("DB_PASS", "********");
define("DB_UNIX_SOCKET", "/tmp/mysql.sock");
define("DB_PORT", 3306);

// create a database connection, using the constants from config/db.php (which we loaded in index.php)
$this->db_connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT, DB_UNIX_SOCKET);

What am i doing wrong? Or preferred what do I need to do to get a connection with the Editor application


  • allanallan Posts: 60,924Questions: 1Answers: 9,929 Site admin

    I've just replied to your question via e-mail as well, but for anyone else looking at this thread:

    Based on the information above the problem is probably that your PHP connection requires the socket location to be specified in the PDO object for your configuration.

    What to do is to add a small modification into the MySQL driver for Editor. If you have a look in `examples/php/lib/Database/Driver/Mysql/Query.php you will find the PDO connection that Editor makes:

    @new PDO(

    I think if you change it to be:

    @new PDO(

    that should do the trick!

This discussion has been closed.