Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Impossible to connect to the database #180

Closed
iDrevniy opened this issue Aug 7, 2014 · 23 comments
Closed

Impossible to connect to the database #180

iDrevniy opened this issue Aug 7, 2014 · 23 comments

Comments

@iDrevniy
Copy link

iDrevniy commented Aug 7, 2014

Somthing strange going on. I couldn't compleet third installation of Pagekit. Previos two atempts didn't cause any problems. But now Pagekit couldn't connect to data base. can't imagine what happened.

@ckdarby
Copy link
Contributor

ckdarby commented Aug 9, 2014

This has nothing to do with Pagekit; Check your configuration for the database. I am able to successfully install Pagekit.

@zwacky
Copy link

zwacky commented Aug 12, 2014

i got the same issue, checked latest version. my db configurations are correctly entered and they even get POSTed correctly.
when i switch to SQLite, it still throws an exception at $this['db']->connect().

with mysql it says: Access denied for user 'root'@'localhost' (using password: NO), even though i set a password and in the checkAction function it's setting $this['config']->set('database.connections.mysql.password', 'my-password').

@Remo
Copy link

Remo commented Aug 13, 2014

this happens for me too, whatever credentials I specify in the installer, it still uses the values from app/config/app.php

@jameswmcnab
Copy link

+1

I had to add my database details to app/config/app.php to get the installer to run.

@grizzlylab
Copy link

+1
I also had to add my database details to app/config/app.php to get the installer to run.

@adam-paterson
Copy link

+1
I also had to add my database details to app/config/app.php to get the installer to run.

@acaron
Copy link

acaron commented Aug 15, 2014

I succeed with the installer but I had to put 127.0.0.1 instead of localhost.

@adam-paterson
Copy link

Even when I put 127.0.0.1 rather than localhost. By the time it gets to \Doctrine\DBAL\Connection::connect it's lost the params set in \Pagekit\Installer\Controller\InstallerController::checkAction. It seems to be falling back and using the params set in app/config/app.php:90 regardless.

@acaron
Copy link

acaron commented Aug 15, 2014

I didn't change my app config, only with the installer and it worked! I will try again later and check in \Doctrine\DBAL\Connection::connect if the params are ok. I just did a quick try of Pagekit and the error message wasn't helpful at all. Also, there was no logs even if the debug mode was on. I will dig further into the code when I can!

@zwacky
Copy link

zwacky commented Aug 15, 2014

tried it again with latest commits and still the same (db access denied).
i'm running ubuntu 14.04, php 5.5.9, apache 2.4.7

@enesgur
Copy link

enesgur commented Aug 15, 2014

try use;

$ sudo service apache2 restart
$ sudo service mysql restart

@adam-paterson
Copy link

I've tried restarting all relevant services.

@Evanion
Copy link

Evanion commented Aug 17, 2014

I'm getting the same during installation.
I remember this issue was present in the private Alpha as well.

@FabienPapet
Copy link

Always Db conection issue with good credentials...
PHP 5.5.12
MySQL 5.6.17
Screen

@sylwit
Copy link

sylwit commented Aug 19, 2014

Same problem, the only way to finish the installation was to manually set credentials in app/config/app.php

@ghost
Copy link

ghost commented Aug 19, 2014

Same problem - tried 127.0.0.1 and localhost
Apache/2.2.14 | PHP 5.4.28 | MySQL 5.1.73 | Ubuntu

@adam-paterson
Copy link

If I get a break during the day here at the agency, I'll boot up a VM and run through it on there to try and find the issue.

Originally I thought it was an issue with MAMP. However it seems to be loosing credentials before the DBAL.

@danielsitek
Copy link

Same problem. And no mather if you choose MySQL or SQLite. It is throwing exception "1046 No database selected". Here is full message:

exception 'PDOException' with message 'SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected' in /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:699
Stack trace:
#0 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(699): PDO->query('SHOW FULL TABLE...')
#1 /pagekit/vendor/pagekit/framework/src/Component/Database/ConnectionWrapper.php(140): Doctrine\DBAL\Connection->executeQuery('SHOW FULL TABLE...', Array, Array, NULL)
#2 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(630): Pagekit\Component\Database\ConnectionWrapper->executeQuery('SHOW FULL TABLE...', Array, Array)
#3 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(206): Doctrine\DBAL\Connection->fetchAll('SHOW FULL TABLE...')
#4 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(250): Doctrine\DBAL\Schema\AbstractSchemaManager->listTableNames()
#5 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(986): Doctrine\DBAL\Schema\AbstractSchemaManager->listTables()
#6 /pagekit/vendor/pagekit/framework/src/Component/Database/Utility.php(38): Doctrine\DBAL\Schema\AbstractSchemaManager->createSchema()
#7 /pagekit/vendor/pagekit/framework/src/Component/Database/Connection.php(53): Pagekit\Component\Database\Utility->__construct(Object(Pagekit\Component\Database\Connection))
#8 /pagekit/extensions/installer/src/Controller/InstallerController.php(65): Pagekit\Component\Database\Connection->getUtility()
#9 [internal function]: Pagekit\Installer\Controller\InstallerController->checkAction(Array)
#10 /pagekit/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php(145): call_user_func_array(Array, Array)
#11 /pagekit/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php(66): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#12 /pagekit/vendor/pagekit/framework/src/Component/Routing/Router.php(290): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /pagekit/vendor/pagekit/framework/src/Framework/Application.php(153): Pagekit\Component\Routing\Router->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /pagekit/vendor/pagekit/framework/src/Framework/Application.php(136): Pagekit\Framework\Application->handle(Object(Symfony\Component\HttpFoundation\Request))
#15 /pagekit/pagekit.php(16): Pagekit\Framework\Application->run()
#16 {main}

Next exception 'Doctrine\DBAL\DBALException' with message 'An exception occurred while executing 'SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'':

SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected' in /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91
Stack trace:
#0 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(702): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(PDOException), 'SHOW FULL TABLE...', Array)
#1 /pagekit/vendor/pagekit/framework/src/Component/Database/ConnectionWrapper.php(140): Doctrine\DBAL\Connection->executeQuery('SHOW FULL TABLE...', Array, Array, NULL)
#2 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(630): Pagekit\Component\Database\ConnectionWrapper->executeQuery('SHOW FULL TABLE...', Array, Array)
#3 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(206): Doctrine\DBAL\Connection->fetchAll('SHOW FULL TABLE...')
#4 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(250): Doctrine\DBAL\Schema\AbstractSchemaManager->listTableNames()
#5 /pagekit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php(986): Doctrine\DBAL\Schema\AbstractSchemaManager->listTables()
#6 /pagekit/vendor/pagekit/framework/src/Component/Database/Utility.php(38): Doctrine\DBAL\Schema\AbstractSchemaManager->createSchema()
#7 /pagekit/vendor/pagekit/framework/src/Component/Database/Connection.php(53): Pagekit\Component\Database\Utility->__construct(Object(Pagekit\Component\Database\Connection))
#8 /pagekit/extensions/installer/src/Controller/InstallerController.php(65): Pagekit\Component\Database\Connection->getUtility()
#9 [internal function]: Pagekit\Installer\Controller\InstallerController->checkAction(Array)
#10 /pagekit/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php(145): call_user_func_array(Array, Array)
#11 /pagekit/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php(66): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#12 /pagekit/vendor/pagekit/framework/src/Component/Routing/Router.php(290): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /pagekit/vendor/pagekit/framework/src/Framework/Application.php(153): Pagekit\Component\Routing\Router->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /pagekit/vendor/pagekit/framework/src/Framework/Application.php(136): Pagekit\Framework\Application->handle(Object(Symfony\Component\HttpFoundation\Request))
#15 /pagekit/pagekit.php(16): Pagekit\Framework\Application->run()
#16 {main}

And even if you choose SQLite, you still need MySQL installed on your system for installation. I'm not sure if it is wrong or not. Maybe it is just another related error, but if I choose SQLite, i would rather go without MySQL or any other db at all..

@chrispecoraro
Copy link

I also confirm that I had this problem. Manually setting everything in app/config/app.php
resolves the problem.

@bjorntheart
Copy link

Manually setting the params in app/config/app.php did not solve the problem for me. I am running pagekit in a VM. I tried setting forwarded ports, changing localhost to 127.0.0.1 and still cannot connect.
SQLite works fine, but have to set the app/config/app.php settings. Form inputs are ignored

@adam-paterson
Copy link

The form inputs are fine for me. Everything required is passed through to the controller. I think this is an issue with the framework. When $this->['config']->set($key, $value); is called on extensions/installer/src/Controller/InstallerController.php:59 it tries to set the information on the App object https://github.com/pagekit/framework/blob/master/src/Framework/ApplicationTrait.php#L54-63. But this information isn't retained when trying to connect.

@adam-paterson
Copy link

This has been fixed in this Commit 16faa99

@saschadube
Copy link
Member

We released the Pagekit Beta today. I close this issue because the code base completely changed. Please open a new issue if it still exists.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests