CompTIA DataSys+ (DS0-001)Database DeploymentMedium
A database administrator is tasked with installing a new MySQL server on a Linux host. After completing the installation, the administrator needs to secure the default root user. Which of the following commands is the most appropriate first step to secure the MySQL installation?
- A`GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;`
- B`CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';`
- C`mysql_secure_installation`
- D`sudo systemctl restart mysql`
Show answer & explanationAnswer & explanation
Correct answer: C. `mysql_secure_installation`
`mysql_secure_installation` is a utility provided by MySQL specifically for initial security setup. It guides the user through setting a root password, removing anonymous users, disallowing remote root login, and removing test databases, making it the most appropriate first step.
Why the other options are wrong
- A. This command grants maximum privileges to the root user, which is the opposite of securing the installation.
- B. Creating a new user is a good practice, but `mysql_secure_installation` also handles the root password and other crucial initial security steps.
- D. Restarting the MySQL service does not secure the installation; it only applies configuration changes or restarts the server.
mysql_secure_installation
A command-line utility provided with MySQL that guides users through essential initial security steps for a new MySQL server installation.
- Sets a strong password for the 'root' user.
- Removes anonymous user accounts.
- Disallows remote 'root' login.
- Removes the 'test' database and its privileges.
- Reloads privilege tables to apply changes.
Memory trick: Secure 'S'tart 'S'erver 'S'trong.