Changing Wordpress default admin user name
If an attacker knows your administrator user name all he needs to do is to guess your password to get in to your system. Wordpress default administrator user is named ‘admin’ and you cant rename it using the WP management panel which makes Wordpress blogs with weak passwords extremely vulnerable, and eventually every password is weak.
You can go into the MySQL database and change the login name of the administrator account to whatever you like.
First backup your database then open up phpMyAdmin and select your Wordpress database, from there select the wp_users table and click the browse tab.
Locate the line with ID set to 1, you can see that the user_login column is set to ‘admin’. Using the Edit tool (Pencil icon) change the user_login (And nothing else) to your desired login name and save your changes.
That’s it, you are now able to log in to your blog as administrator with your unique user name.
Advanced Users:
Instead of browsing through tables and web interfaces you can run this line from your MySQL console of choice, modify the NewLogInName value to your desired login and execute.
UPDATE `wp_users` SET `user_login` = ‘NewLogInName‘ WHERE `wp_users`.`ID` =1 LIMIT 1 ;
PHP script:
This script will change the admin username for you, edit it and set your desired administrator username. Upload it to the Wordpress home directory and run it.
Make sure you delete the file from the server when you’re done.
<?php
/*
Changing the Wordpress administrator username.
http://www.aviran.org
*/
$NewAdminUserName="Aviran";
include("wp-config.php");
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link)
die('Could not connect: ' . mysql_error());
if(!mysql_db_query(DB_NAME, "UPDATE wp_users SET user_login='$NewAdminUserName' WHERE wp_users.ID=1 LIMIT 1"))
echo "Error. Could not change administrator username.";
echo "Username changed successfully";
mysql_close($link);
?>