Symfony 4 - Database connection refused - php

Symfony4
PHP 7.2.19
Ubuntu Linux 18.04.2 ( Up to date)
MySQL 5.7.27
Its seems like I cannot get access to my database.
I do have access to phpMyAdmin with the same user & password.
I downloaded a D8 to test if it is working with this installation:
Surprisingly it works, with the same user I can set up a D8 installation.
If I download a fresh Symfony4 project the issue persists.
Its the first time I got this issue,
.env
DATABASE_URL=mysql://user:userPW#localhost:3306/db
This is my CLI output:
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ..

Related

SQLSTATE[HY000] [2002] Connection refused in Laravel 8

Using Laravel 8
Ubuntu 20.04 with Docker
Connect to Database over clients worked perfect. Docker-Container worked.
If I dont start it with php artisan serve it refused the connection to mysql.
With php artisan serve it connects to mysql-docker-container.
I want deploy it. But if I make it like this doc: https://laravel.com/docs/8.x/deployment
it worked fine, but only DB-connection crashes.
I tried: SQLSTATE[HY000] [2002] Connection refused within Laravel homestead
But if I change the Host it answer with this mistake: PDOException: SQLSTATE[HY000] [2002] No such file or directory
need help.
dont forget... WSL :)
use mysql not localhost.

Error when trying to create doctrine database with phpMyAdmin

I'm a fresh junior php developer and I'm building my first Symfony project.
When I used the command : php bin/console doctrine:database:create
I get these errors :
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] No such file or directory*
I'm actually using MAMP with default config "db_user" and "db_password"
so I edited the .env file with this following code :
DATABASE_URL=mysql://root:root#localhost:8889/mydbname
I know there is something wrong with my host or port, I saw on other topics that some users using MAMP keep Symfony default values for host and port : DATABASE_URL=mysql://root:root#127.0.0.1:3306/mydbname
Thanks for reading me and trying to help me.
I did more searches and some people are saying that localhost syntax is depreciated and prefer using : 127.0.0.1 instead of localhost.
In my case I checked and used Mamp config 'Connect using an UNIX socket'
So it's now working with :
DATABASE_URL=mysql://root:root#127.0.0.1:8889/mydbname

eZ Platform: Error: "SQLSTATE[HY000] [2002] No such file or directory" when I try to generate GraphQL schema

I've installed eZ Platform on my Mac using the eZ Launchpad docs: https://ezsystems.github.io/launchpad/.
After the installation, I'm able to successfully access the platform and start creating the Content Model.
I would also like to use GraphQL, so I followed the instructions: https://doc.ezplatform.com/en/latest/api/graphql/.
Unfortunately I get an error when I try to generate the schema using the commands:
php bin/console ezplatform:graphql:generate-schema
php bin/console cache:clear
This is the error I get:
In ExceptionConversion.php line 169:
Database error
In AbstractMySQLDriver.php line 93:
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 31:
SQLSTATE[HY000] [2002] No such file or directory
In PDOConnection.php line 27:
SQLSTATE[HY000] [2002] No such file or directory
Here's the app/config/parameters.yml:
# This file is auto-generated during the composer install parameters:
env(SYMFONY_SECRET): ThisEzPlatformTokenIsNotSoSecret_PleaseChangeIt
env(DATABASE_DRIVER): pdo_mysql
env(DATABASE_HOST): localhost
env(DATABASE_PORT): null
env(DATABASE_NAME): ezplatform
env(DATABASE_USER): root
env(DATABASE_PASSWORD): null
env(DATABASE_CHARSET): utf8mb4
env(DATABASE_COLLATION): utf8mb4_unicode_520_ci
env(DATABASE_VERSION): mariadb-10.2.26
Looks like you have executed the composer and symfony commands directly from your host and you have setup the project using launchpad.
Try this instead:
~/ez sfrun ezplatform:graphql:generate-schema
~/ez sfrun cache:clear
With ezlaunchpad your app is running in the docker container so you have to execute all common symfony/ez commands through the ~/ez shell. Executing commands from host can lead to file permission issues as well.

How do I run downloaded project of laravel from cloud9 on localhost server?

I have made a project on cloud 9 using laravel.
Downloaded it.
Extracted in my project directory wamp/www/laravel.
I have been giving the following command on gitbash.
cd e:/wamp/www/laravel
then
php artisan serve
Then going to localhost:8000 in my browser,following error occurs
PDOException in Connector.php line 55:
SQLSTATE[HY000] [1045] Access denied for user 'yash2code'#'localhost' (using password: NO)

Can't connect to mysql Laravel-forge

I've just purchased a subscription atnforge for 10 dollars/month.
But when I want to connect to mydatabase (mysql),
it's telling me:
Connected to host, but unable to connect to database forge.
Be sure that the database exists and that you have the necessary
privileges.
MySQL said: Unknown database 'forge'
I have an email from forge with my login information. I can ssh into my server. I've also set my ssh key on my mac.
What am I doing wrong? Here a pic with my info:
EDIT:
Also when I deploy from github I receive this error message:
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO)
But yesterday it worked! Now it doesn't?
EDIT:
ERROR LOG:
From github.com:
* branch master -> FETCH_HEAD
Already up-to-date.
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
> php artisan optimize
Generating optimized class loader
Compiling common classes
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO)

Categories