Alexis_D
Alexis_D

Reputation: 1958

Cannot create database with terminal doctrine:database:create

I cannot succeed in creating a database with Symfony throught the terminal

(I use a MAC and MAMP)

The line in the Terminal

MacBook-Pro-de-XXX:Symfony XXX$ php app/console doctrine:database:create

The answer I got in Terminal

Warning: PDO::__construct(): MySQL server has gone away in /Applications/MAMP/htdocs/Symfony/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 40

Warning: PDO::__construct(): Error while reading greeting packet. PID=52773 in /Applications/MAMP/htdocs/Symfony/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 40

Could not create database for connection named `symfony`
SQLSTATE[HY000] [2006] MySQL server has gone away

Here some other information that might help you help me to find where the probleme come from

the parameters.yml file in Symfony/app/config

# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_host: localhost:8888
database_port: null
database_name: symfony
database_user: root
database_password: root
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ThisTokenIsNotSoSecretChangeIt

Upvotes: 0

Views: 1637

Answers (2)

fsperrle
fsperrle

Reputation: 1302

Make sure that the MySQL server is actually running. Also the MAMP default port for MySQL is 3306 and not 8888.

database_host: localhost
database_port: 3306

Upvotes: 4

jagad89
jagad89

Reputation: 2643

modify your host. if you have running mySql service on port 8888 your configuration should be as

    database_host: localhost 
    database_port: 8888

if your mysql running on default port, use below configuration

    database_host: localhost 
    database_port: null

hope this helps.

sorry for my bad english.

Upvotes: 6

Related Questions