Create Joomla Super Administrator using SQL

Original post courtesy of projectamplify.com:

There are a number of reasons why you may need to re-create a Joomla! super administrator, most of them are to get you out of trouble if your main Joomla! “admin” account has been corrupted or changed.

Recently we installed an Admin content restriction extension into a clients project at their request. Needless to say it was not well designed and fried all super admin logins! So we thought this information will be bound to help someone out!

Here is how to create a new user in Joomla! 1.5 manually, using the database management tool, phpMyAdmin. (For those who want to know how to use phpMyAdmin tool, it is a tutorial in itself so search for it and thee shall find!).

There are a couple steps involved as the database contains user information spread over a number of tables so we will run 3 segments of SQL code into the “Insert SQL” tab in phpMyAdmin.

Step 1

Create the new Joomla! User

REPLACE INTO `jos_users` (`id`, `name`, `username`, `email`, `password`, `usertype`, `block`, `sendEmail`, `gid`, `registerDate`, `lastvisitDate`, `activation`, `params`) VALUES ('60', 'Admin2', 'admin2', 'user@usersemailaddress', '21232f297a57a5a743894a0e4a801fc3:abcdefghijklmnopqrstuvwxyz012345', 'Super Administrator', '0', '0', '25', '2000-01-01 00:00:00', '0000-00-00 00:00:00', '', '');

The code above creates a new user with ID number 60 and the name set to admin2.

Step 2

Create an ARO object out of the new Joomla! user

REPLACE INTO `jos_core_acl_aro` (`id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES ('8', 'users', '60', '0', 'Admin2', '0');

This creates an ARO object with ID number 8. Note that the ‘name’ field must match the ‘name’ field in Step 1

Step 3

Next you will need to map this ARO object to the Super Administrator group, which by default is group ID 25:

REPLACE INTO `jos_core_acl_groups_aro_map` (`group_id`, `section_value`, `aro_id`) VALUES ('25', '', '8');

The user is now ready to login using “admin: admin2, password: admin”. We use the REPLACE instead of INSERT function above because the query will fail if the database record already exists.

Hope this helps!

Comments

comments

Recent Posts
  • amber

    hi,

    I tried the above insert,

    getting the following error.

    #1054 – Unknown column ‘gid’ in ‘field list’

  • Johnny

    Didnt work, the password is wrong probally