I am trying to connect my database with MySQL, but I have the following error:
[Doctrine \ DBAL \ Exception \ ConnectionException] An exception occured in driver: SQLSTATE [HY000] [2002] Connection refused
I have my project in the following path (I'm using OS X Capitan): /Applications/ XAMPP/htdocs/Projects/Cupon
. I'm trying to complete the get and set methods automatically with the command: php app/console doctrine:generate:entities TiendaBundle
.
Class code (Project/Cupon/src/Cupon/TiendaBundle/Entity/Tienda.php):
<?php
namespace Cupon\TiendaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/** @ORM\Entity */
class Tienda
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/** @ORM\Column(type="string", length=100) */
protected $nombre;
/** @ORM\Column(type="string", length=100) */
protected $slug;
/** @ORM\Column(type="string", length=10) */
protected $login;
/** @ORM\Column(type="string", length=255) */
protected $password;
/** @ORM\Column(type="string", length=255) */
protected $salt;
/** @ORM\Column(type="text") */
protected $descripcion;
/** @ORM\Column(type="text") */
protected $direccion;
/**
* @ORM\ManyToOne(targetEntity="Cupon\CiudadBundle\Entity\Ciudad")
* @ORM\JoinColumn(name="ciudad_id", referencedColumnName="id")
*/
protected $ciudad;
}
I have a database called "symfony" in MySQL (XAMPP 5.6.3) and my configuration file in Symfony is as follows:
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: null
database_name: symfony
database_user: root
database_password: '123'
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: c11eccf2a788b331cb9548ff4106c7461
I don't know how I can connect my project Symfony with my database in phpmyadmin.