Home >Database >Mysql Tutorial >Learn more about the installation and configuration of MySQL on Debian

Learn more about the installation and configuration of MySQL on Debian

PHPz
PHPzOriginal
2023-04-20 10:12:072168browse

Debian is a very popular Linux operating system. Its installation and configuration are very simple, even for novice users. Installing MySQL on Debian is no exception. This article will guide you through the installation and configuration of MySQL on Debian.

  1. Update software source information

Before installing MySQL, you need to update the information of the local software repository. Use the following command to update the software repository:

sudo apt-get update
  1. Install MySQL

Use the following command to install MySQL:

sudo apt-get install mysql-server
  1. Configure MySQL

Once the MySQL installation is complete, you can start configuring MySQL.

First, use the following command to start the MySQL service:

sudo systemctl start mysql

Then, run the following command to enable the MySQL service and set it to start automatically when the system starts:

sudo systemctl enable mysql

Now you can check if the MySQL service is running using the following command:

sudo systemctl status mysql

If everything is fine, you should see the MySQL service is running.

  1. Set MySQL root user password

By default, the MySQL root user has no password. To protect the security of your MySQL database, you need to set a MySQL root user password.

Use the following command to set the password of the MySQL root user:

sudo mysql_secure_installation

In this script, you need to answer some questions, such as whether to delete anonymous users, whether to prohibit remote root user login, etc. . Just follow the prompts and enter the appropriate information. Finally, you will be asked to set the password for the MySQL root user. Please do not use an empty password and choose a strong password to ensure the security of your database.

alright! At this point you have successfully installed and configured MySQL on Debian operating system. Now you can use the MySQL client to connect to the database and start using it.

Summary

This article introduces you to how to install and configure MySQL on the Debian operating system. Although the installation and configuration of MySQL may seem a bit complicated, the steps listed in this article should be enough to assist you in successfully installing and configuring MySQL on Debian.

Whether you are a newbie or an experienced Linux user, we believe this article can provide you with useful information to help you install MySQL on Debian.

The above is the detailed content of Learn more about the installation and configuration of MySQL on Debian. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn