"if someone is unauthorized to enter the database, isn't it too late to worry about passwords?"
You assume a poor database design in which authorization data is collected with application data.
The principle of "separation of problems" and the principle of "Least Access" suggest that user credentials should be stored separately from everything else.
For example, save user credentials on an LDAP server.
Also, your question suggests that database credentials are the only credentials. Again, the principle of least access assumes that you have application credentials that are separate from the database credentials.
The username and password of your web application are NOT the username and password of the database. Similarly for a desktop application. Application authentication may not necessarily be database authentication.
In addition, good security assumes that access to usernames and passwords is stored separately from application data. In a large organization with a large number of database users, one administrator must be a “security officer” and handle authentication and authorization. No other users can change the authorization, and the security officer does not have access to the application data.
This is a quick audit to ensure that a security officer never accesses data. It's a little trickier, but another audit can be sure that people with data authorization are real people, not pseudonyms for a security officer.
Hashed passwords are part of a working security policy.
source share