Change User ID after recreating account

So in playing around and setting up Emoncms on my own Ubuntu server, I loaded some sample data and ended up deciding to delete the one and only user and starting again.

So I recreated my user from the login screen and have just realised that I have no admin access. A forum search shows that the admin user must be user 1, however by deleting a user and starting from scratch, the system allocated me User ID 2 - hence no Admin access. And because I deleted User ID 1, I have no way of logging in that way.

So, short of starting from scratch with a new install (I really really don’t wanna do that) - is there any other way?

I’m thinking of access mysql via the command line and changing the User ID to 1 - will that break anything ? Or is there an ‘admin’ tag inside the mysql datase as well?

Any help appreciated .

Pete M

This has happened before. Did you try searching here?

Note - this relates to an old version of emonCMS - locations and names (i.e. settings.php) have changed, but I’m not familiar with the details.

Hi Robert,

Yes I’d done a search prior to posting. Those thread you linked don’t help out my particular issue.

Update: Problem solved.

I backed up the mysql database from using MYSQL at the command line, then updated UserID 2 from Admin = 0 to Admin =1

(UPDATE users SET admin=1 WHERE id=2;)

Logged out, logged back in. Admin functions are back.


1 Like