Jump to content

Cannot connect to db: Link to database cannot be established: SQLSTATE[HY000] [1045]


Recommended Posts

I've created a PrestaShop app on my server and everything works there.

I was trying to create my dev version, so I copied all files from server to my localhost.

I run my app using lampp.

Dev version doesn't work, because I got:

Link to database cannot be established: SQLSTATE[HY000] [1045] Access denied for user 'srv38468_pr1'@'localhost' (using password: YES)
at line 136 in file classes/db/DbPDO.php

I checked app/config/parameters.php:

    'database_host' => 'localhost',
    'database_port' => '',
    'database_name' => 'srv38468_pr1',
    'database_user' => 'srv38468_pr1',
    'database_password' => '****************',
    'database_prefix' => 'pr_',
    'database_engine' => 'InnoDB',

and this is a db's config from my server:

image.png.c309378f5be180203e69da5a41257ac5.png

I see this error is very popular but I've checked all solutions and nothing works.

Does anyone have any ideas, how I can solve it?

Link to comment
Share on other sites

3 hours ago, AgnieszkaK said:

I've created a PrestaShop app on my server and everything works there.

I was trying to create my dev version, so I copied all files from server to my localhost.

I run my app using lampp.

Dev version doesn't work, because I got:

Link to database cannot be established: SQLSTATE[HY000] [1045] Access denied for user 'srv38468_pr1'@'localhost' (using password: YES)
at line 136 in file classes/db/DbPDO.php

I checked app/config/parameters.php:

    'database_host' => 'localhost',
    'database_port' => '',
    'database_name' => 'srv38468_pr1',
    'database_user' => 'srv38468_pr1',
    'database_password' => '****************',
    'database_prefix' => 'pr_',
    'database_engine' => 'InnoDB',

and this is a db's config from my server:

image.png.c309378f5be180203e69da5a41257ac5.png

I see this error is very popular but I've checked all solutions and nothing works.

Does anyone have any ideas, how I can solve it?

try this way:

'database_host' => 'localhost',

'database_port' => '',

'database_name' => 'srv38468_pr1'.sql',

'database_user' => 'root',

'database_password' => ' ', <--- leave empty

'database_prefix' => 'pr_',

'database_engine' => 'InnoDB',

 

Danny

Link to comment
Share on other sites

7 hours ago, AgnieszkaK said:

I've created a PrestaShop app on my server and everything works there.

I was trying to create my dev version, so I copied all files from server to my localhost.

I run my app using lampp.

Dev version doesn't work, because I got:

Link to database cannot be established: SQLSTATE[HY000] [1045] Access denied for user 'srv38468_pr1'@'localhost' (using password: YES)
at line 136 in file classes/db/DbPDO.php

I checked app/config/parameters.php:

    'database_host' => 'localhost',
    'database_port' => '',
    'database_name' => 'srv38468_pr1',
    'database_user' => 'srv38468_pr1',
    'database_password' => '****************',
    'database_prefix' => 'pr_',
    'database_engine' => 'InnoDB',

and this is a db's config from my server:

image.png.c309378f5be180203e69da5a41257ac5.png

I see this error is very popular but I've checked all solutions and nothing works.

Does anyone have any ideas, how I can solve it?

Hi, 

Did you gave all permissions to database user when you create it ?

Link to comment
Share on other sites

@AgnieszkaK

This kind of error can occur for two reason

 

1. when you create a database you need to assign the user to the database and then allow all kind of permission to that database.

2. In PrestaShop configuration the database information is correct or not. Also check your db prefix is match

 

Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...