MySQL is an open-source relational database management system. Its one of the popular relational management system.
Mysql is commonly installed as part of the popular LAMP or LEMP (Linux, Apache/Nginx, MySQL/MariaDB, PHP/Python/Perl) stack. It implements the relational model and Structured Query Language (SQL) to manage and query data.
In this guide we are going to install mysql 8 on Debian 11.
Related Content
- How to install Mysql Server 8 on OpenSUSE Leap 15.3
- How to install and Configure Mysql Server 8 on Fedora 34/35
- How to install Mysql 8 on Rocky Linux/Centos 8
- How to Install and Set Up mysql 8 on Ubuntu 20.04
- How to run Mysql 8 with Docker and Docker-Compose
- Using Ansible to Install and Initialize Mysql 8 on Centos 8
- Mysql Permissions & Create, Update, Delete Database Users
- Install and Setup Nginx, WordPress and Mysql 8 in Centos 8
- Create an RDS instance in terraform with a Mariadb Example
Table of Content
- Ensuring the server is Up to date
- Set up the repo for mysql 8 installation
- Installing Mysql 8 server
- Starting and enabling mysql service
- Testing mysql installation
Ensuring the Server is Up to date
Before proceeding, let us ensure that our debian server is up to date. Use this command to update the server packages:
|
|
Next, let us install common packages that we will need in our tutorial
|
|
Set up the repo for mysql 8 installation
Mysql server 8 is not available in the default Debian repositories. The mysql team provides a downloadable .deb
file that will configure the repositories for mysql server 8 installation. Download it with this command:
|
|
You should see an output almost similar to this:
|
|
Once the download is done, we need to install the downloaded deb file. Use this command to install:
|
|
This will open a configuration window prompting you to choose mysql server version and other components such as cluster, shared client libraries, or the MySQL workbench.
For now since we are only interested in the Mysql Server Installation, leave the default (Mysql Server and cluster) settings and click OK to proceed.
This is the output on successful installation and configuration.
|
|
Installing Mysql 8 server
Now that the repos have been added to include mysql server, we can now install the mysql-server package. First, refresh the repositories to get the latest from the added repo:
|
|
Then Install Mysql 8 Server using this command:
|
|
Enter your administrator credentials, and the system will install the MySQL server package, client packages, and database common files.
The installation will prompt you to enter and confirm a root user and password for the MySQL database.
Use this command to check the info of the installed package to confirm that we installed the mysql version that we want:
|
|
Starting and enabling mysql service
In debian, Mysql server will be styarted by default. Check the status of the service to confirm that it is actually running:
|
|
The Active: active (running) since ...
indicates that the service is up and running.
To enable the service to start on reboots, use this command:
|
|
To view the MySQL 8 service log as follows using the journalctl command:
|
|
5. Testing MySQL Installation
Let us check mysql version with this command:
|
|
Now you can Login as the root
user and the password specified above.
|
|
Conclusion
In this article, we managed to install and test mysql 8 installation on Debian 11.