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

Can a database be created with no user and/or owner?

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

Problem

Maybe this is a good or a bad question but in my Google research I wasn't able to find out a good answer (maybe because I suck at performing a good search). In a few words:

  • can a DB be created without a user and/or owner?



I am trying to answer a question on Stack Overflow and the user has shared it DB configuration and something caught my attention:

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = 'gotche';
$db['default']['dbdriver'] = 'mysqli';


The database does not have a username!

Regardless the DB used - which is in scenario is MySQL (don't know the version) - is this possible?

I don't think the username and password were removed for security reasons: It would be better to change it to something like * - in that case everyone would know there is a username/password but I can ask the user if that's the reason.

Solution

MySQL allows for a blank user with a blank password (anonymous access) to connect.

See Securing the Initial MySQL Accounts


If accounts for anonymous users were created, these have an empty user
name. The anonymous accounts have no password, so anyone can use them
to connect to the MySQL server.

Besides that, MySQL does not have the concept of "database owner", like SQL Server and Postgres do. There is a privilege system, where users can be assigned various types of access to databases, tables, etc, with GRANT statement.

Context

StackExchange Database Administrators Q#205053, answer score: 8

Revisions (0)

No revisions yet.