1

I'm trying to set a local dev environment on a Debian VirtualBox and am now stuck for days with the following situation.

After setting up apache, php, mysql, pma and got eveything running, I open the mysql console with root user. I create the empty database, "use" it then "source" the file I want to load. When finished, I eventually exit from the client. I can connect again, exit as many times as I want... I also can access to phpmyadmin with the same root user, and confirm that the database was properly loaded.

Everything's fine, till I reboot debian. From now on, I stick to :

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I've tried to access with different users, nothing changes. Same thing for phpmyadmin.

As I work with Vbox snapshots,I've determined that the issue seems related to the database. Rebooting after creating the empty database is fine, I'm still able to connect.

I've crawled many related topics accross the web, and couldn't come up with that particular situation, and all the approaching topics solutions start with connecting with root user - which I can't do.

What am I missing ?

Thanks for your help !

1

Oh, you nailed it!

It seems that my dump actually contained mysql.user data, so that after loading the database, I could only connect with these distant login information. Taking a look at this mysql.user table, it appears that these login were specified, not for localhost, but the distant host.

Anyway... Knowing this, I've been able to connect to mysql client, then reset these login info :

mysql –u root –p [distant password]
use mysql.user UPDATE mysql.user
SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
quit

I finally deleted these distant host lines from phpmyadmin, to be sure not to mess anything up.

Thanks a lot for your help !

0

Did you load a new mysql.user table when you loaded your new data? Sounds like you wiped your previous root user. Take a look at the script and see. Also, as @RickJames suggested, you might want to look here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.