Adrian Ber Adrian Ber - 8 months ago 30
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;.