sudo mysql_secure_installation
The sudo mysql_secure_installation command is a MySQL script that helps improve the security of a newly installed MySQL server. Here's a detailed overview of what it does:
1. Change the root password: The script will prompt you to change the default root password for the MySQL server. It's important to set a strong, unique password to secure your MySQL installation.
2. Remove anonymous users: By default, MySQL creates an anonymous user account that can access the database without authentication. The script will remove this anonymous user account.
3. Disallow remote root login: The script will disable the ability to log in remotely as the root user. This helps prevent unauthorized access to your MySQL server.
4. Remove test database: MySQL also creates a test database by default. The script will remove this test database to reduce the attack surface of your MySQL server.
5. Reload privilege tables: After making the above changes, the script will reload the MySQL privilege tables to ensure the changes take effect.
Here's an example of what the sudo mysql_secure_installation command output might look like:
Securing the MySQL server deployment.
Enter password for user root:
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
... Success!
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
... Success!
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
... Success!
All done!
Securing the MySQL server deployment. Enter password for user root: New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y ... Success! All done!
The sudo mysql_secure_installation script is a convenient way to quickly improve the security of a new MySQL installation. It's generally recommended to run this script after installing MySQL, especially in a production environment.
0 Comments
CAN FEEDBACK
Emoji