How to change the WordPress administrator user ID

Once you have done a WordPress database backup, connect to your WordPress database using the MySQL command line tool or the web based phpMyAdmin and execute the below queries on the WordPress database.

UPDATE wp_users SET ID = 1024 WHERE ID = 1;
UPDATE wp_usermeta SET user_id = 1024 WHERE user_id = 1;

The above MySQL query will change the default WordPress administrator user ID from 1 to 1024 in the wp_users table and wp_usermeta table, where user related data is stored.


Once you execute the above query, WordPress will assign a user ID of 2049 to the next WordPress user you create.

Note: Always specify a high value for the new WordPress administrator ID. The higher the value is the less chances of it being discovered and the longer an attack will take.