0

guys. I know that post not fully related to programming. But I really need someone help. So my problem is:

I have Symfony2 application, I move it from localhost to development server with, but I cant run application because I geeting error:

 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'xx.xx.xxx.xxx' (4)' in /var/www/route/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 40

I trying to find solution in Stackoverflow and in internet, I found that mysql has config file which blocking external resources and accept only 127.0.0.1 address, so I commented both lines as described here.

My Symfony2 database parameters looks like:

parameters:
  database_driver: pdo_mysql
  database_host: localhost
  database_port: null
  database_name: db_name
  database_user: user
  database_password: pass

Can someone help to me? Thanks!

2
  • database_port: null, why is it normal?, I do not know about Symfony2 but the mysql port normal is 3306, for the other parameters you know best check that you can connect with the MySQLWorkbench Commented Nov 19, 2015 at 19:46
  • @PetterFriberg, using mysqli php extension I can connect to database and all works fine, I really cant get why this doent work with pdo Commented Nov 19, 2015 at 20:01

2 Answers 2

3

Check logs in app/logs/dev.log and/or you server logs.

Are you sure that hostname an user/password combination are correct?

Where is your database? If I understood it correctly, you have your own VPS? If so, how you've configured it?

Probably it's not a serious issue, but we need more data.

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

Comments

0

+1 @Mateusz Sip

You probably have a specific configuration or simply not have properly installed and configured mysql on your server.

Also you should try to do mysql -u yourusername -p If it ask for your password , mysql is installed. Enter your password and let know us if you are correctly logged in.

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.