After SQL import of full database, login failed

After SQL import of full database, login failed

by dna helix -
Number of replies: 12
i tried to test a moodle site for backing up and restoring.

first i went into phpmyadmin of my host and selected the moodle database and exported the full database to .sql file

next i used phpmyadmin on my PC (wamp server), created a database moodledb2 and imported the .sql (file created in the first step)

then i made the change in config.php to the new database

when i started to browse this on my pc, the front page looks fine..

but it does not allow me to login with the username and password that was created on the original installation (host).

i checked the users table content and the md5 hash is the same for the online one and my pc one.

can someone please help me..?
Average of ratings: -
In reply to dna helix

Re: After SQL import of full database, login failed

by Ravishankar Somasundaram -
Hello,

It would help a bit if you can say us what kind of error you are seeing,

If you get an invalid username and password error, then for sure it is something to do with the database record for that particular username.


In reply to Ravishankar Somasundaram

Re: After SQL import of full database, login failed

by dna helix -
The error is :
Invalid login, please try again

The error is same for all the usernames

In reply to dna helix

Re: After SQL import of full database, login failed

by Mike Korn -
This happened to me the other day. My problem was that the config.php started with <<? instead of <?. I have seen this in others when they had extra spaces at the very end of config.php. Sometimes these small errors are really hard to spot.

Hope that helps,

Mike


In reply to Mike Korn

Re: After SQL import of full database, login failed

by Ravishankar Somasundaram -
You had <<? instead of <? which returned a error message saying invalid username or password ?
In reply to dna helix

Re: After SQL import of full database, login failed

by Michael Kapus -
Having the same problem. Did you ever sort this out?
In reply to Michael Kapus

Re: After SQL import of full database, login failed

by satyajit Choudhury -

Hello all,

             I also encounter the same problem when i was upgrading the my Test machine. after importing the MYSQL DB backup to the Test database, when i upgrade moodle to 1.9.7 and tried to login it was not allowing me to login as ADMIN. I also check from backend from DB to change the password, but it didn't worked (using mdl_user table).

At last i had to change the password with this help of emails. Clicked on forgot password and then it asked for username/email address and than it sent the password through emial.

If your ADMIN user has different email address you cna change it from mdl_user table and place your email address there and this way you can have the password sent to you.

I think it is an security feature for moodle 1.9.7.

Hope this help.

~Satyajit

In reply to satyajit Choudhury

Re: After SQL import of full database, login failed

by Michael Kapus -
Thank you for your reply. I can't even get the email to change the forgotten password. I am trying to import my users into a fresh moodle instal via myphp admin import. I can get all the users info into the new database but can't log any of them in. If you think of anything let me know. I have also tried CSV format and import directly through Moodle upload users.
In reply to Michael Kapus

Re: After SQL import of full database, login failed

by satyajit Choudhury -

You can do this, after everything is down and you are about to login to the Moodle Site, for example as Admin User:

1. Go to MYSQL or whatever DB.

2. Update the email address for the user "admin" in mdl_user table.

      for example:

          UPDATE mdl_user SET email = 'satyajit@r00t4u.com' where user = 'admin';

3. Now Your email address has been updated. Now you can go to the browser and click on forgot password.

4. It will ask for the username/email address and once you give that it will send you the temporary generated password through email.

Hope this help.

~Satyajit

In reply to dna helix

Re: After SQL import of full database, login failed

by planetoid h. -
I met the same problem. I copy this line

$CFG->passwordsaltmain = "...."

in the old configuration file of old moodle server to new configuration file of new server.

I solved my problem. More about password salting: http://docs.moodle.org/eu/report/security/report_security_check_passwordsaltmain
--
Moodle 1.9.9+ (Build: 20100630)
Average of ratings: Useful (1)
In reply to planetoid h.

Re: After SQL import of full database, login failed

by vinoth kumar -

thank you i am also have the problem with login

invalid login please try again 

i changed to the old configuration its fine working  thanks

In reply to planetoid h.

Re: After SQL import of full database, login failed

by Ogoni Olomu -

Thanks planetoid h.

I had the same problem and was able to correct it in the config.php

by making use of your method to solve it.