0
votes

My specific question: How can I troubleshoot a failure to create a database using a Symfony2 parameters.ini file?

This has to do with Windows7 and Symfony2. I am trying to create a database after configuring Symfony2, and I fail. (Details: I am working on Windows 7 64 bit, xampp 1.7.7 with PHP 5.3.8 and Symfony2 2.0.14).

When I try this from a command line:

php app/console doctrine:database:create

I get this:

Could not create database for connection named <comment>jobeet</comment>
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

My parameters.ini file looks like this:

[parameters]
    database_driver="pdo_mysql"
    database_host="localhost"
    database_port="3306"
    database_name="jobeet"
    database_user="root"
    database_password="[intentionally left blank]"
    mailer_transport="smtp"
    mailer_host="localhost"
    mailer_user=""
    mailer_password=""
    locale="en"
    secret="[intentionally left blank]"

I can start MySql from the command line (mysqld --console), and get to MySql as a root user (mysql -p[intentionally left blank] -u root) and create a database (CREATE DATABASE test;), so I think my server is running and I can use it.

I suspect the problem with "Access denied for user 'root'@'localhost'" has to do with it not having the password for MySql root.

If anyone has ever run into this before, and knows what to do, your help would be much appreciated.

I attempted to GRANT ALL PRIVILEGES with the following:

mysql> grant all privileges on *.* to 'root'@'localhost';
Query OK, 0 rows affected (0.05 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

I'm worried that is says '0 rows affected'. That can't be good.

Here is my config.yml. Plz let me know if you see problems.

imports:
    - { resource: parameters.ini }
    - { resource: security.yml }

framework:
    #esi:             ~
    #translator:      { fallback: %locale% }
    secret:          %secret%
    charset:         UTF-8
    router:          { resource: "%kernel.root_dir%/config/routing.yml" }
    form:            true
    csrf_protection: true
    validation:      { enable_annotations: true }
    templating:      { engines: ['twig'] } #assets_version: SomeVersionScheme
    session:
        default_locale: %locale%
        auto_start:     true

# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    # java: /usr/bin/java
    filters:
        cssrewrite: ~
        # closure:
        #     jar: %kernel.root_dir%/java/compiler.jar
        # yui_css:
        #     jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar

# Doctrine Configuration
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true

# Swiftmailer Configuration
swiftmailer:
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%

jms_security_extra:
    secure_controllers:  true
    secure_all_services: false
1
Did you happen to GRANT ALL PRIVILEGES to the jobeet database with the ROOT username? - Dave Mascia
could you add the doctrine part from you config.yml - Sgoettschkes

1 Answers

0
votes

You created a database named test, not jobeet.