How to change username after the installation?


#1

How to change the username easily post installation. I have many sites on the same server, however, I want to change the username of a single site!

Any idea?

Note: Already got the best way, install myPHPAdmin in EE. Access the site database. Change it from there.


#2

Do you mean WP user?

cd /var/www/domain.com/htdocs
wp user create <username> <user_email> --user_pass=p4ssw0rd --role=administrador
wp user delete <your_old_user>

No need to mess with MySQL, minimizing risks.


#3

To overwrite the admin user (with id=1) you can use:

wp db query "update wp_users set user_login='$admin_user', user_pass='$hash', user_nicename='Admin User', user_email='$admin_mail' where ID=1";

whereby hash is set in bash, like:

hash=$(openssl passwd -1 $admin_pass)


#4