Forums / General Questions / Can't connect to database after server move

Can't connect to database after server move

Views: 1,626

Results 1 to 5 of 5
28 Apr 2017, 10:18 PM
#1
hp9 avatar

hp9

New Zenner

Join Date:
Aug 2004
Posts:
20
Plugin Contributions:
0

Can't connect to database after server move

Within the same hosting company, Dreamhost, I moved a Zencart installation from a shared server to a VPS. I had to change the username, which changed the path. I updated this in the configure.php files in Includes and in admin/includes. The database connection did not change, and we tested it and it still connects outside of Zencart.

Now I get this message:

"Sorry!
There seems to be a problem connecting to our database. Please give us a few minutes to remedy the problem. Thank you."

The hosting company says everything should work, and they have no idea what's wrong. I even tried changing the database username, but that didn't help.

Any ideas?
Thanks.

carbideemporium.com
Zencart 1.5.5
PHP 5.6

29 Apr 2017, 12:49 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Can't connect to database after server move

Considering that you switched from one "server" to another, did the ip address per chance change? Is the database user authorized to access the database from the "new" server?

Click on the username for the applicable database(s) and should be presented with the acceptable list of "sources" from which that user can access the database... might fix the issue. And if it does, I'm disappointed in the support that was offered, if not, I'm a bit stumped as well other than also trying to create a new server "host" and then transfer the database or similar actions.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Apr 2017, 1:00 AM
#3
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: Can't connect to database after server move

see:

https://www.zen-cart.com/content.php?338-There-seems-to-be-a-problem-connecting-to-our-database

the problem is almost definitely in your configure.php file.

i'm not sure how dreamhost does their vps. but on their shared server, they separate the db server from the web server. so frequently in the configure.php, you have a value other than localhost for DB_SERVER. i would examine very closely the following constants:

define('DB_TYPE', 'mysql'); // always 'mysql'
define('DB_PREFIX', ''); // prefix for database table names -- preferred to be left empty
define('DB_CHARSET', 'utf8'); // 'utf8' or 'latin1' are most common
define('DB_SERVER', 'localhost');  // address of your db server
define('DB_SERVER_USERNAME', 'username');
define('DB_SERVER_PASSWORD', 'password');
define('DB_DATABASE', 'db_name');

if you can connect outside of ZC, there is no reason why you should not be able to connect within ZC.

good luck.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

29 Apr 2017, 3:44 AM
#4
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Can't connect to database after server move

I even tried changing the database username.

I read that as "Had to create a new database user." and then wonder if permission to access the database was also given. As it is a separate step after creating a new database user, it is easy to overlook.

The learning is in the doing.

Potent Products

1 May 2017, 4:52 AM
#5
hp9 avatar

hp9

New Zenner

Join Date:
Aug 2004
Posts:
20
Plugin Contributions:
0

Re: Can't connect to database after server move

Thanks for the help. I asked the third DH support person if the new server had permission to access the db. He then fixed it right away.