Adrian Ber Adrian Ber - 10 months ago 35
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.


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;.