mysql cpanel new server/url

mysql cpanel new server/url

by Dave Cuttriss -
Number of replies: 7
There's lot of helpful stuff in this Forum but despite having searched I can't see anything that reflects my problem. Perhaps someone can point me in the right direction:
I have to move a moodle 1.7 site to a new server (Linux/apache etc) and new URL.
Problem; I've backed up the database but I can only use Cpanel to restore it. Cpanel insists on prepending the "new" database on the "new" server with the "new" site name. i.e. if the "old" database name was wwwolds__mdle1 then on the "new" server it is automatically named wwwnews_mdle1. I can't change the database name after restore ( no priviliges...but that I think could anyway be problematic, even dangerous, on a shared server) so where do I go to change the moodle set up to point to the new name database?
(I realise I'm going to have to change many paths in the database but fortunately it's quite small at present)
Any help appreciated and sorry if this has been covered elsewhere, I have looked....
Dave
Average of ratings: -
In reply to Dave Cuttriss

Re: mysql cpanel new server/url

by Dave Cuttriss -
p.s is it just config.php? In that case which lines do I change?
$CFG->dbname = 'wwwmoan_mdle1' ;
$CFG->dbuser = 'wwwmoan_mdle1' ;

Also line: $CFG->dbpass = 'LOsjFfvLpuSh' ; i don't remember ever setting this: is it something that Moodle has done & in that case should I leave it as it is?
Aso line $CFG->prefix = 'mdl_' What does this mean?

Sorry to be a pain but I really don't know much about mysql

Dave
In reply to Dave Cuttriss

Re: mysql cpanel new server/url

by John Isner -
Yes, you found it!

Change $CFG->dbname, $CFG->dbuser, and $CFG->dbpass to be the correct values for your new database. $CFG->prefix is a string that will be become a prefix of all the tables you create in the database. So for example, the 'question' table will be named mdl_question, etc.
In reply to John Isner

Re: mysql cpanel new server/url

by Dave Cuttriss -
Thanks John but gloom has descended.
I created a new database and populated it with the contents of the "original" database and used that as the moodle database as I just couldn't get the "original" to work: something to do with the password I'm sure.
I really thought I'd cracked it but now every time I try to log in the browser hangs and only comes up after half a minute to say that :
Your session has timed out. Please login again.
Is this is an error in the database do you think or where should I be looking?
Cheers

Dave
In reply to Dave Cuttriss

Re: mysql cpanel new server/url

by John Isner -
It may be hanging because Moodle is unable to write session data (session data is written in the moodledata directory, not the database). What is the permission on your moodledata directory? Make sure it is something like 777.
In reply to John Isner

Re: mysql cpanel new server/url

by Dave Cuttriss -
Yes it's set to 777. When I "log in" it hangs for about 30 secs and then goes to the front page but still with the "you are not logged in" at the top right hand corner
In reply to Dave Cuttriss

Re: mysql cpanel new server/url

by Dave Cuttriss -
I've managed to get everything up and running by creating a new instance of Moodle 1.7 on the site, linking it to the backed up database (suitably adjusted for the new URL) and then copying over the various directories from the "original" moodle (e.g. mods etc)
Why the original "back up" version doesn't work though is a bit of a mystery as I can't (quickly) see any difference between it and the "new" instance.
Thanks anyway, at least it's working now.
Cheers
Dave
In reply to Dave Cuttriss

Re: mysql cpanel new server/url

by Michael McLannahan -

I know it's too late to help but I too had this issue. My ISP moved my server without my knowledge and downed all my pages...Thanks...

Anyway. I too was getting the same error "Session expired" and looping back to the front page. I'd re-done all the config and it all appeared to work but I couldn't log in!

My solution was to delete all contents of moodledata (outside my webroot in my case) and let Moodle recreate it. It then sorted its own permissions out (777 for the moodledata folder IIRC) and recreated the folders (and htaccess too)

It did appear to be empty at first but a fresh FTP session and a few refreshes revealed old data. Deleted Cache and Sessions (both folders and the contents) and all was happy again!!

Hope this may help someone else as it's a bit late for you now!

Kind regards

Michael