Adamski
Adamski

Reputation: 3685

access denied to mysql root after flush privileges

I'm battling with a strange issue here. I am setting up an Amazon EC2 server, installed with Ubuntu Server 12 LTS, to serve our web app.

I installed mysql, and then had some issues with being unable to access with the root password I had set.

Suspecting a conflict with a possible default install (I thought I had checked), I completely removed mysql including the user.

Starting fresh, I set a root password which then worked. I set up phpMyAdmin, got that working, but then when trying to set a password for a user following an import, I got "could not find row" error.

Upon some searching I found that 'FLUSH PRIVILEGES;' could help remedy the problem. So I went back into the server, logged into mysql as root, and performed the flush command.

I was then logged out of phpMyAdmin with an access denied error, and since then have been unable to log back into mysql on the server.

The full error is:

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

I am quite confused, already spent a lot of time trying to find out what the problem could be. Any help would be much appreciated. Thanks in advance.

Upvotes: 0

Views: 912

Answers (2)

Arya
Arya

Reputation: 2153

Ha! Use --databases and include only your DB: http://dev.mysql.com/doc/refman/5.5/en/mysqldump-copying-to-other-server.html

Upvotes: 1

Adamski
Adamski

Reputation: 3685

This was caused by my data import being from a full mysqldump, which I did now know would contain all user tables including root, which therefore overwrote my root user.

I guess there is a way to prevent either the export or import of the mysql table somewhere.

Learn something new everyday, as they say..

Upvotes: 0

Related Questions