
Setting up a robust database server is a fundamental step for many applications, and MySQL is a popular choice known for its reliability and performance. If you are running Debian 10, also known as Buster, getting the latest version of MySQL up and running is a straightforward process that involves adding the official repository and using the standard package management tools.
The first essential step is to ensure you have the correct source for the software. Debian’s default repositories may not always contain the absolute latest release of MySQL 8. To fix this, you’ll need to add the official MySQL APT repository. This is typically done by downloading a specific repository package provided by MySQL. Once downloaded, you install this package using dpkg
, which configures your system to recognize the new repository source.
After adding the repository, it’s crucial to update your package lists. This ensures that your system is aware of the packages available from the newly added repository. You achieve this by running the standard apt update
command. This command fetches the package information from all configured sources, including the MySQL repository you just added.
With your package lists updated, you can now proceed with the main installation. The core package you need is mysql-server
. Execute the command apt install mysql-server
. Your package manager will then download and install the necessary components, including the server daemon, client utilities, and other related files. During the installation, you will likely be prompted to set a root password for the MySQL server. It is critical to choose a strong and secure password here, as this account has full administrative privileges.
Immediately after the installation completes, a vital step for security is running the security script provided by MySQL. This script helps you improve the security of your MySQL installation by performing several important actions, such as removing anonymous users, disallowing remote root logins, and removing the test database. You initiate this script by running the command mysql_secure_installation
. Follow the prompts carefully, making choices that enhance your server’s security posture.
Finally, it’s good practice to verify that the MySQL service is running correctly. You can check the status of the service using a command like systemctl status mysql
. You should see output indicating the service is active and running. You can also test connectivity by attempting to log in as the root user using the command mysql -u root -p
and entering the password you set earlier. If you get a MySQL command prompt, your installation is successful and ready to use.
By following these steps, you will have a securely installed and operational MySQL 8 server on your Debian 10 system, ready to host your databases.
Source: https://kifarunix.com/install-mysql-8-on-debian-10-buster/