Skip to main content
Home
Admin Recipes

Main navigation

  • Home
  • Contact

Breadcrumb

  1. Home

Installing and Configuring MySQL on Debian

Installing and Configuring MySQL on Debian

MySQL is one of the most popular database management systems. Below are the steps to install and configure MySQL on Debian.

Step 1: System Update

It's recommended to start by updating your system:

sudo apt update && sudo apt upgrade -y

Step 2: Install MySQL

Installing MySQL is straightforward:

sudo apt install mysql-server -y

Step 3: Check MySQL Status

After installation, check if MySQL is running correctly:

sudo systemctl status mysql

Step 4: Configure MySQL

Run the MySQL secure installation script:

sudo mysql_secure_installation

Follow the prompts to set the root password and configure security options.

Step 5: Login to MySQL

You can log in to MySQL using the following command:

sudo mysql -u root -p

Step 6: Create Database

To create a new database, use the following command inside the MySQL console:

CREATE DATABASE my_database;

Step 7: Create User and Assign Privileges

Create a new user and grant them the necessary privileges:

CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON my_database.* TO 'user'@'localhost';
FLUSH PRIVILEGES;

Your MySQL is now installed and configured on Debian.

Tags

  • Debian
  • MySQL
  • Installation
  • Configuration
  • Database
  • Linux

Language version switcher

  • English
  • Polish
RSS feed
Powered by Drupal