Adding an admin user account

In this section, we are going to build a MySQL script that you can use for adding a new admin account within seconds. It is recommended to have a salted password hash ready. This is easy, you can generate it online , by running this PHP code (replace the sample pass and salt with yours):

1
2
3
$pass = "12345678";
$salt = "at";
echo md5($salt.$pass).":".$salt;

Copy the result. Password hash Paste into the MySQL script:

INSERT INTO admin_user
SELECT
NULL user_id,
"ATWIX" firstname,
"DOT COM" lastname,
"admin@atwix.com" email,
"atwix" username,
"e58d34d72aefb6d6f6c6e419da695252:at" password,
NOW( ) created,
NULL modified,
NULL logdate,
0 lognum,
0 reload_acl_flag,
1 is_active,
(SELECT MAX(extra) FROM admin_user WHERE extra IS NOT NULL) extra,
NULL rp_token,
NOW() rp_token_created_at;

INSERT into admin_role
SELECT
NULL role_id,
(SELECT role_id FROM admin_role WHERE role_name = 'Administrators') parent_id,
2 tree_level,
0 sort_order,
'U' role_type,
(SELECT user_id FROM admin_user WHERE username = 'ATWIX') user_id,
'ATWIX' role_name
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s