CPSA ยท Database security
How applications connect to databases
How apps connect to MS SQL, Oracle, MySQL and Access, connection strings and authentication methods.
Key points
- Connection string: server, database, credentials or integrated auth.
- SQL Server: Windows Authentication (trusted connection, preferred) or SQL Server Authentication (password sent, often stored on the client).
- MySQL: initial root must have a password.
- Microsoft Access: a file via a driver, no network service.
- Risks: leaked connection strings (config, markup); over-privileged accounts turn SQL injection into full compromise.
Source: https://learn.microsoft.com/en-us/sql/relational-databases/security/choose-an-authentication-mode
Practice questions
What is a SQL Server connection made with Windows Authentication also called?
- A trusted connection
- A mixed-mode login
- A dedicated admin connection
- A proxy connection
Show answer
Answer: A. A trusted connection
Because SQL Server trusts the credentials Windows validated, it is called a trusted connection. SQL Server Authentication is the one where the login and password are given to SQL Server.
Which practices make application-to-database connectivity safer?
- Connect with a least-privileged application account
- Use the sa login so every query works
- Prefer Windows Authentication where it is available
- Keep the connection string outside the web root and protect it
- Leave the MySQL root password empty for local use
Show answer
Answer: A. Connect with a least-privileged application account, C. Prefer Windows Authentication where it is available, D. Keep the connection string outside the web root and protect it
A least-privileged application account and Windows Authentication (where available) limit damage and avoid stored passwords. Using sa or a blank password is the opposite.
True or false: the MySQL account root@localhost created at installation is harmless, so no password is needed.
Show answer
Answer: False
False. It is a superuser with all privileges; with an empty password anyone able to connect as root gets full control, so a password must be set.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
