Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to reset my Joomla admin password by executing the following code in MySQL:

INSERT INTO `jos_users` (`id`,`name`, `username`, `password`, `params`)
VALUES (LAST_INSERT_ID(),'Administrator2', 'admin2',
'd2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199', '');

INSERT INTO `jos_user_usergroup_map` (`user_id`,`group_id`)

When I attempt to execute it, I get the following error:

Failed to execute SQL : SQL INSERT INTO `jos_users` (`id`,`name`, `username`, `password`, `params`) VALUES (LAST_INSERT_ID(),'Administrator2', 'admin2', 
'd2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199', ''); INSERT INTO
`jos_user_usergroup_map` (`user_id`,`group_id`) VALUES (LAST_INSERT_ID(),'8'); failed : 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `jos_user_usergroup_map` (`user_id`,`group_id`) VALUES (LAST_INSERT_' at line 1

Could someone tell me where my Syntax might be wrong? I'm using MySQL version 5.0.95.

share|improve this question

Use back ticks (`) around column name password (password is a reserved work in MySQL) if you are not using. Don't use LAST_INSERT_ID() in the first query as you have not added any record to this table yet. The queries will be

INSERT INTO jos_users (`name`, `username`, `password`, `params`) 
VALUES ('Administrator2', 'admin2', 'd2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199', '');

INSERT INTO `jos_user_usergroup_map` (`user_id`,`group_id`)

Make sure you run these queries in the same session.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.