HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Is there always a MySQL user that has all privileges on all databases?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
databasesallprivilegesuseralwayshasmysqlthatthere

Problem

For example, does root always have all privileges on all databases?

If I create a new database, will this user automatically have all privileges on the new database without having to run a GRANT command?

Solution

Mysql by default creates a single or multiple root user accounts (this depends on the mysql version) that are indeed superusers and have full access to all databases that you create on that mysql server. However, these accounts are initialised as superusers and you can remove their access rights based on your requirements. Or at least you can rename the superuser accounts from root to something else to make it even more harder to hack your mysql server. Any superuser account with all privileges granted to . and with grant option added will have full access to any newly created database on the mysql server.

Technically, it is possible not to have any superuser account in a mysql server, but it does not make much sense. Such accounts should be used as a last resort only, but they can be handy in case of an emergency.

Context

StackExchange Database Administrators Q#159151, answer score: 3

Revisions (0)

No revisions yet.