Moved site to new ISP

Permalink
Hello,

I have just moved one of my sites to a new server and I am getting this error message:

Unable to connect to database.

A database error occurred while processing this request.

Catchable fatal error: Argument 1 passed to ConfigStore::__construct() must be an instance of Database, null given, called in /home/largsgol/public_html/updates/concrete5.4.2.1/concrete/models/config.php on line 48 and defined in /home/largsgol/public_html/updates/concrete5.4.2.1/concrete/models/config.php on line 136

I have followed the instructions on moving sites and done it successfully several times in the past.

Put site in maintenance, deleted cache, backed up SQL, copied site across, imported SQL, and changed the site.php file for the database credentials.

Anyone any ideas?

Kind regards
Scott

 
adz replied on at Permalink Reply
adz
Have you moved the database to the new server? Or made a copy of it on the new server?

Also have you modified the config/site.php file with the new information for the new database?

Ad
scooterb69 replied on at Permalink Reply
Hello,

I have done a db export of the database and then imported it to an empty database on the new server. I have also edited the config/site.php with the new details.

Thanks
madon replied on at Permalink Reply
madon
Try to look at this maybe...
http://www.concrete5.org/documentation/installation/moving_a_site/...
it helped me alot
scooterb69 replied on at Permalink Reply
Hello,

Thanks that is what I use everytime I move a site and this is the only time I have had problems

Cheers
tyssen replied on at Permalink Reply
I'm having the same trouble. This is only the second C5 site I've done, but I didn't have this trouble with the first one. I had trouble importing the db into the cPanel for this site so just copied and pasted the SQL into the SQL tab instead but I wouldn't have thought that would make a difference as I can see all the tables have been created.
tyssen replied on at Permalink Reply
Of course, it helps if you actually get the login credentials right. :/
scooterb69 replied on at Permalink Reply
I got to the bottom of it. I ended up scrapping the DB I was moving too and recreating it from scratch yet again. I also had ! in my sql password, took these out and works a treat now. Thanks for the responses
activa replied on at Permalink Reply
Hi, had the same issue.

First, a note: if you're migrating a site to a host other than the registrar, or creating a site on a host different from the DNS nameserver record, and you're using shared hosting, the C5 config will insert root server's address into the site.php. This had me stumped for a while.

When tech support and I finally figured it out we changed it to the correct site root (the domain name). The site loaded fine the first time AND THEN WE HAD THIS PROBLEM. The issue was that the database credentials had to be re-initialized, as MySQL had for some reason rejected them.
Pixelfixer replied on at Permalink Reply
Pixelfixer
" The issue was that the database credentials had to be re-initialized, as MySQL had for some reason rejected them."

What do you mean by "re-initialized"?

I am getting this same error as defined on the original post. My client called me to say that their client couldn't access their site and that it was showing error codes. I first refreshed the code from my side and then got this error. I called my host provider and the support person doesn't have a clue what might have happened to cause this. Since nothing appears to have been done on the front end, (no edits made recently) I suspect that my host may have been moving sites to new servers or something, since they have been working to fix intermittent problems on my shared server in the past few months.

Anyway, can anyone give me a clue as to how to get this database re-connected? I have opened it in PHPadmin and the site.php settings match the database.
activa replied on at Permalink Reply
To be honest, the tech guy with the host did it, and I'm not exactly sure what he did, but I suspect you can replicate what he did by going into phpmyadmin and deleting the admin account and then recreating it with the same name and login.

t's worth a try (but of course be sure you know what you're doing, if you delete the admin account and don't set it up again right you may lose access to the database, and I don't know how that might impact the database salt value).
Pixelfixer replied on at Permalink Reply
Pixelfixer
Thanks for the suggestion, but I don't feel comfortable with MySQL to be playing with it. I have hope that this is a simple fix if the right expert glances at this post. But then, it could be anything I guess.

I tried installing a new C5 installation on a new account on a new server and then importing the export file from the database on the current system. I couldn't get the import to complete without an error. So maybe the database is corrupted.

If anyone else has a clue for me, I'd love to hear your suggestion.
activa replied on at Permalink Reply
I suppose restarting mysql would also do that, but of course if it's shared hosting that'snot something you can control.
bishopdennis replied on at Permalink Reply
bishopdennis
I know you've probably figured all this out by now, but for others searching the forums, I submit my story.

I had the same problem ... word for word.

Then I stumbled upon the username & password for the db ... and then I remember when I initially installed the db on the first host that I needed to set privileges. I had not been asked to do so.

A bit of lead up to having this problem. I had followed the procedures of exporting the database, and importing it. Site didn't work. Then I realized that I had to make a database, before I could import it. (Make the NEW database the same name as the OLD if you can, it's easier that way.) There may be other ways to do it, but I went into mysql databases from the cPanel. I set my db up in there, and then used myphpadmin to import the database. At that point is when I had the problem mentioned initially in this thread.

I then realized I had to set a USER for the database. I found the USERNAME in the config/site.php file, along with the password. After creating that user in the mysql database page from cPanel, I added the user to the database. When I added the user to the database it took me to a page where I was asked to set privileges (which are ... ALTER, CREATE, DROP, DELETE, INDEX, INSERT, SELECT, UPDATE).

Amazing ... after I did that ... it all worked. I hope this helps any other novices (like me) out there. I got it all done, and I still have a bit of hair left that I didn't pull out. Maybe this will allow you to keep most of yours. :-)
natenine replied on at Permalink Reply
You are totally right! I forgot to add the user to the database!! :D