Table of Contents
Strengthen MariaDB security" >Strengthen MariaDB security
Authentication method" >Authentication method
Home Computer Tutorials Computer Knowledge How to install MariaDB database on Debian 12

How to install MariaDB database on Debian 12

Feb 20, 2024 pm 02:24 PM
mariadb debian vps sql statement Tencent Cloud

如何在 Debian 12 上安装 MariaDB数据库

MariaDB is an open source multi-threaded relational database management system and a replacement for MySQL. MariaDB is the default replacement for MySQL in Debian.

This tutorial explains how to install MariaDB on Debian 12.

Preparation conditions

1. A VPS virtual machine with Debian 12 installed (it is recommended that you purchase an Alibaba Cloud VPS or Tencent Cloud VPS virtual host. If you prefer foreign servers, it is recommended that you try VPS on Vultr, and you will get $50 for registration. USD experience, very cost-effective), of course you can also use it on your own computer or virtual machine.

2. If you use VPS, for security reasons, it is recommended to use a non-root account. You can create an account with sudo permissions on Debian 12.

Install MariaDB

At the time of writing this article, the latest MariaDB version available in Debian main is version 10.11.4, so you can install it directly from the command line using the command.

First, perform the following steps as root or user with sudo privileges to install MariaDB on Debian 12:

Execute the following command in the command terminal to install the MariaDB database.

1. Update software package

sudo apt update
sudo apt install mariadb-server
Copy after login

2. After the installation is completed, the database service will start automatically. You can check whether the service is normal through the following command.

sudo systemctl status mariadb
Copy after login

You will see output similar to the following:

● mariadb.service - MariaDB 10.11.4 database server
    Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
    Active: active (running) since Sun 2024-01-14 13:16:27 CST; 22h ago
      Docs: man:mariadbd(8)
            https://mariadb.com/kb/en/library/systemd/
  Main PID: 5224 (mariadbd)
    Status: "Taking your SQL requests now..."
    Tasks: 8 (limit: 2235)
    Memory: 161.6M
      CPU: 1.791s
    CGroup: /system.slice/mariadb.service
            └─5224 /usr/sbin/mariadbd
Copy after login

Strengthen MariaDB security

MariaDB comes with a script that can help you make your installation more secure. To start the script type mysql_secure_installation in the terminal:

sudo mysql_secure_installation
Copy after login

During script execution, you will be prompted to set a password for the root user, delete anonymous users, restrict the root user's access to the local computer, and delete the test database.

Similar to the following:

...
Enter current password for root (enter for none):
...
Set root password? [Y/n] Y
New password:
Re-enter new password:
...
Remove anonymous users? [Y/n] Y
...
Disallow root login remotely? [Y/n] Y
...
Remove test database and access to it? [Y/n] Y
...
Reload privilege tables now? [Y/n] Y
...
Thanks for using MariaDB!
Copy after login

After configuring options, the script will reload the permissions table, ensuring changes take effect immediately.

All steps will be explained in detail. If you have no special personal requirements, it is recommended to select "Y" (yes) for all questions.

Authentication method

By default, the MariaDB root user uses the unix_socket authentication plugin, which checks the valid user ID when calling the mysql client tool.

This means that you can only connect to the MariaDB server as root if you call the mysql command as the system root or add sudo to the command.

For improved security, it is recommended to keep the default authentication plugin and allow the root user to authenticate only through Unix sockets.

If you want to change root authentication to classic authentication, log in to the MariaDB server and execute in the command line terminal:

sudo mysql
Copy after login

Run the following SQL statement to change authentication:

ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_root_passwd';
Copy after login

You can now connect to the MariaDB server using the new password:

mysql -u root -p
Copy after login

The Change Authentication plugin also allows you to log in as root from an external program such as phpMyAdmin

Write at the end

In this tutorial, we show you how to install MariaDB database on Debian 12 server.

The above is the detailed content of How to install MariaDB database on Debian 12. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Recognition from the first prize of Science and Technology Progress Award: Tencent solved the problem of training large models with trillions of parameters Recognition from the first prize of Science and Technology Progress Award: Tencent solved the problem of training large models with trillions of parameters Mar 27, 2024 pm 09:41 PM

The list of recipients of the China Electronics Society’s 2023 Science and Technology Awards has been announced. This time, we discovered a familiar figure—Tencent’s Angel machine learning platform. In the current era of rapid development of large models, the Science and Technology Award is awarded to machine learning platform research and application projects, fully affirming the value and importance of model training platforms. The Science and Technology Award recognizes the research and application of machine learning platform projects, and fully recognizes the value and importance of model training platforms, especially in the context of the rapid development of large-scale models. With the rise of deep learning, major companies have begun to realize the importance of machine learning platforms in the development of artificial intelligence technology. Google, Microsoft, Nvidia and other companies have launched their own machine learning platforms to accelerate

How to query oracle database logs How to query oracle database logs Apr 07, 2024 pm 04:51 PM

Oracle database log information can be queried by the following methods: Use SQL statements to query from the v$log view; use the LogMiner tool to analyze log files; use the ALTER SYSTEM command to view the status of the current log file; use the TRACE command to view information about specific events; use operations System tools look at the end of the log file.

Tencent Hunyuan large model has been fully reduced in price! Hunyuan-lite is free from now on Tencent Hunyuan large model has been fully reduced in price! Hunyuan-lite is free from now on Jun 02, 2024 pm 08:07 PM

On May 22, Tencent Cloud announced a new large model upgrade plan. One of the main models, Hunyuan-lite model, the total API input and output length is planned to be upgraded from the current 4k to 256k, and the price is adjusted from 0.008 yuan/thousand tokens to fully free. The Hunyuan-standardAPI input price dropped from 0.01 yuan/thousand tokens to 0.0045 yuan/thousand tokens, a decrease of 55%, and the API output price dropped from 0.01 yuan/thousand tokens to 0.005 yuan/thousand tokens, a decrease of 50%. The newly launched Hunyuan-standard-256k has the ability to process ultra-long text of more than 380,000 characters, and the API input price has been reduced to 0.015 yuan/thousand toke.

GPT Store can't even open its doors. How dare this domestic platform take this path? ? GPT Store can't even open its doors. How dare this domestic platform take this path? ? Apr 19, 2024 pm 09:30 PM

Pay attention, this man has connected more than 1,000 large models, allowing you to plug in and switch seamlessly. Recently, a visual AI workflow has been launched: giving you an intuitive drag-and-drop interface, you can drag, pull, and drag to arrange your own workflow on an infinite canvas. As the saying goes, war costs speed, and Qubit heard that within 48 hours of this AIWorkflow going online, users had already configured personal workflows with more than 100 nodes. Without further ado, what I want to talk about today is Dify, an LLMOps company, and its CEO Zhang Luyu. Zhang Luyu is also the founder of Dify. Before joining the business, he had 11 years of experience in the Internet industry. I am engaged in product design, understand project management, and have some unique insights into SaaS. Later he

How to use sql statement to query the storage structure of mysql database How to use sql statement to query the storage structure of mysql database Apr 14, 2024 pm 07:45 PM

To query the MySQL database storage structure, you can use the following SQL statement: SHOW CREATE TABLE table_name; this statement will return the column definition and table option information of the table, including column name, data type, constraints and general properties of the table, such as storage engine and character set.

How to install and configure Samba file sharing service in Debian How to install and configure Samba file sharing service in Debian Mar 28, 2024 am 11:16 AM

Installing and configuring the Samba file sharing service in Debian can be completed by the following steps: 1. Install Samba: First, install Samba using the apt package manager: sudoaptupdate sudoaptinstallsamba 2. Configure Samba: Edit Samba’s main configuration file /etc/samba/smb .conf: sudonano/etc/samba/smb.conf In the file, you can define the configuration of the shared directory and shared user. The following is an example configuration: [share] comment=SharedFolder

How to export the queried data in navicat How to export the queried data in navicat Apr 24, 2024 am 04:15 AM

Export query results in Navicat: Execute query. Right-click the query results and select Export Data. Select the export format as needed: CSV: Field separator is comma. Excel: Includes table headers, using Excel format. SQL script: Contains SQL statements used to recreate query results. Select export options (such as encoding, line breaks). Select the export location and file name. Click "Export" to start the export.

Tencent Hunyuan upgrades model matrix, launching 256k long text model on the cloud​ Tencent Hunyuan upgrades model matrix, launching 256k long text model on the cloud​ Jun 01, 2024 pm 01:46 PM

The implementation of large models is accelerating, and "industrial practicality" has become a development consensus. On May 17, 2024, the Tencent Cloud Generative AI Industry Application Summit was held in Beijing, announcing a series of progress in large model development and application products. Tencent's Hunyuan large model capabilities continue to upgrade. Multiple versions of models hunyuan-pro, hunyuan-standard, and hunyuan-lite are open to the public through Tencent Cloud to meet the model needs of enterprise customers and developers in different scenarios, and to implement the most cost-effective model solutions. . Tencent Cloud releases three major tools: knowledge engine for large models, image creation engine, and video creation engine, creating a native tool chain for the era of large models, simplifying data access, model fine-tuning, and application development processes through PaaS services to help enterprises

See all articles