2

while my tunnel is connected (af tunnel) I'm trying to run a cakephp console app that would connect to my mysql database (through the tunnel).

I have this in my database config:

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => '11111111ZQyI',
    'password' => '11111111111MR',
    'database' => '111111111111115bc',
    'port' => '10000',
    'prefix' => '',
    //'encoding' => 'utf8',
);

I would get this error message:

Error: exception 'MissingConnectionException' with message 
'Database connection "Mysql" is     missing, or could not be 
created.' in /.../lib/Cake/Model/Datasource/Database/Mysql.php:161
Stack trace:
#0 /..../lib/Cake/Model/Datasource/DboSource.php(262): Mysql->connect()
colin
  • 87
  • 5
  • you asked a question that you answered within the same minute... `-1 on both` – Samuel Cook Apr 25 '13 at 02:26
  • 2
    why is that a -1? I spent 15min searching for the answer. I was doing it to save the next poor sap from wasting 15min of their time too. I think it's important to get the correct information out on the web. that is all. – colin May 16 '13 at 20:33
  • I wish I could downvote a comment, because SamuelCook I'd be down voting yours. Colin is right, it's VERY important to get the correct information out on the web, regardless of if he answered it within a minute. I've had this problem for the last 20 minutes, and this answer helped me. +1 on BOTH! – mickburkejnr Jun 16 '13 at 12:04
  • the funny thing is that stackoverflow seems to facilitate you answering your own questions. Trust me, I'm not looking for points, this is all about getting the word out. – colin Jun 28 '13 at 04:43
  • You did fine. it's great to have people like you who answer their own questions. +1 for you.! – Francisco Corrales Morales Apr 22 '14 at 16:51

1 Answers1

2

The answer was that I needed to somehow invoke mysql to connect of TCP instead of sockets. Apparently when you use localhost it automatically triggers a Socket connection and if you use 12.0.0.1 it triggers a TCP connection. So this was the solution:

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => '127.0.0.1',
    'login' => '11111111ZQyI',
    'password' => '11111111111MR',
    'database' => '111111111111115bc',
    'port' => '10000',
    'prefix' => '',
    //'encoding' => 'utf8',
);
colin
  • 87
  • 5