afs125874
afs125874

Reputation: 53

An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused Trying to create a database on symfony 3.4

I tried to create a databse in doctrune 3.4 with php bin/console doctrine:database:create command but I get this error

`Failed loading /opt/lampp/lib/php/extensions/no-debug-non-zts-20180731`/xdebug.so:  /opt/lampp/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so: cannot open shared object file: No such file or directory

In AbstractMySQLDriver.php line 103:

  An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused  


In PDOConnection.php line 47:

  SQLSTATE[HY000] [2002] Connection refused  


In PDOConnection.php line 43:

  SQLSTATE[HY000] [2002] Connection refused

This is the setting on config.yml

doctrine:
    dbal:
        driver: pdo_mysql
        host: '%database_host%'
        port: '%database_port%'
        dbname: '%database_name%'
        user: '%database_user%'
        password: '%database_password%'
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci

I'm uging xampp MariaDb 10.1 version and the doctrine built-in server to develop

Upvotes: 1

Views: 1441

Answers (1)

Muamar Ali
Muamar Ali

Reputation: 155

Maybe you did not yet configure your parameters.yml as indicated in official documentation of symfony.

Before you launch the command to create database, you have to configure first in parameters.yml and check also in the config.yml

Check it here: https://symfony.com/doc/3.4/doctrine.html

or if you want, if you can access the mysql terminal. Just directly create database there.

Example: CREATE DATABASE 'database_name' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Upvotes: 3

Related Questions