Adrian Ber Adrian Ber - 1 year ago 74
MySQL Question

How can I change root username in MySQL

I'm running MySQL in Ubuntu, default installation.

How can I change the username from

to another one, let's say
? Preferably from the command line.

Answer Source

After connecting to MySQL run

use mysql;
update user set user='admin' where user='root';
flush privileges;

That's it.

If you also want to change password run

update user set password=PASSWORD('new password') where user='admin';

before flush privileges;.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download