Bitzu

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

Single choice

What is a SQL Server connection made with Windows Authentication also called?

  1. A trusted connection
  2. A mixed-mode login
  3. A dedicated admin connection
  4. 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.

Select all that apply

Which practices make application-to-database connectivity safer?

  1. Connect with a least-privileged application account
  2. Use the sa login so every query works
  3. Prefer Windows Authentication where it is available
  4. Keep the connection string outside the web root and protect it
  5. 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

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.

Download on the App StoreGet it on Google Play

More CPSA topics in this module