0
votes

H, I am a newbie to cake php. So there is a problem i'm facing with.

I have installed XAMPP and my cakephp project folder lies in htdocs(/opt/lampp/htdocs/cakephp). When I start cake bake by the command /.cake bake, I am getting a mysql error as below.

enter code here

PHP Warning:  mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /opt/lampp/htdocs/cakephp/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552

can u help me?

2
What does your config/database.php file say? - RabidFire
class DATABASE_CONFIG { var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'root', 'password' => '', 'database' => 'cake_blog_tutorial', 'prefix' => '', );} This is the content in database.php in config folder - yohannan_sobin

2 Answers

0
votes

Check if you have MySQL installed properly.

0
votes

With XAMPP normally get this error.

You can do two things to solve it:

  1. A clean installation of Apache + PHP + MySQL
  2. If you're on a linux or on a mac you can create a symbolic link to the socket:

    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
    

Where /tmp/ is your XAMPP mysql folder (e.g. /opt/lampp/var/mysql/mysql.sock)