Customize security for your MySQL server by running the following command:
- sudo mysql_secure_installation
You will be presented with some security options that you should choose to secure MySQL.
- Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
- Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
- Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Normally, the MySQL service will start automatically when the package is configured. To check if the MySQL server is running, use the command:
- sudo systemctl status mysql
If the MySQL server does not start automatically, you can start it using the following command.
- sudo systemctl enable mysql