0

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
0

2 Answers 2

6

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.

Sign up to request clarification or add additional context in comments.

2 Comments

but now when using the following: doctinge:schema:update --dump-sql I got the following: Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' ... I don't undersand because all the php.ini field I have the following date.timezone: "Europe/Berlin"
You most likely have multiple php.ini files... epicfoobar.com/2013/10/how-to-set-time-zone-in-symfony2 shows some more ways to set the timezone directly in the app
4

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.