Removed admin - how to get back into Dashboard

Permalink
Hi guys, I was doing some stuff on my dev box and deleted my admin user
mysql>delete from Users;


My purpose was to get rid of all my test users, and yeah ... I didn't think about 'admin'. So, any help would be greatly appreciated. Can't I just add an admin user from mysql and somehow assign it the correct permissions?

tash
 
kdyer replied on at Permalink Reply
kdyer
If you can restore your MySQL DB from say a couple of days ago, that would probably be the easiest.

Second thing to try is to re-install C5 (from the download, check the Readme/INSTALL files for how to install/re-install on your site..

The other thing you can try is an INSERT SQL in the users table.

Good luck!

HTH,

Kent
tash replied on at Permalink Reply
tash
Problem is, I don't have a very recently copy of the db. Won't reinstalling wipe the db? My preferred method is to just INSERT into Users the admin user and populate all the columns with the correct values. Does anyone know what I should populate the following with?

uIsActive
uIsValidated
uIsFullRecord

My assumption would be Yes, Yes, Yes respectively, but I doubt I'm right. Maybe 1, 1, 1 respectively?

And after I insert admin into Users, do I need to do anything else with any other tables?
tash replied on at Permalink Reply
tash
I got some assistance in #concrete5 and got this fixed. For anyone that cares to know, here's what I did.

I created a file in my home directory and added the following code:

<?php
function encryptPassword($uPassword, $salt){
echo md5($uPassword . ':' . $salt);
}
$pass = 'password';
$salt = 'salt from config/site.php';
encryptPassword($pass,$salt);
?>


Ran that php script and used the outputted encrypted password in my mysql insert statement

mysql> insert into Users (uID, uName, uEmail, uPassword, uIsActive, uIsValidated, uIsFullRecord) values ('1','admin', 'your_email', 'encrypted_password', '1', '-1', '1');