Username 'root' can be changed in mysql or can I assume there is always a user named 'root' with all the privileges?

advertisements

Question explain itself. In mysql i can always suppose there will be a user named 'root' having all privileges or the name can be changed? I'm writing a shell script that needs to do some administrative task on a database and i was guessing if i have to ask user only root password or root username too.


Yes you can(After logging into mysql) :

use mysql;
update user set user='urDesiredName' where user='root';

Mysql is a database that contains user regarding information like names, roles, priviledges etc informations.

do flush privileges; It will only clear the db cache and will reset root to [userNewRoot].