Skip to content

Commit c5d5ea9

Browse files
author
Dianna Hoober
committed
updates to version
1 parent e6fb945 commit c5d5ea9

6 files changed

Lines changed: 92 additions & 32 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"git.autorefresh": false
2+
"git.autorefresh": false,
3+
"powershell.pester.codeLens": false
34
}

docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/Installing_MariaDB_on_Debian9.png renamed to docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/Installing_MariaDB_on_Debian12.png

File renamed without changes.

docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
slug: how-to-install-mariadb-on-debian-9
3-
title: "Installing MariaDB on Debian 9"
4-
title_meta: "How to Install MariaDB on Debian 9"
5-
description: "This guide shows how to install and configure the MariaDB server on Debian 9."
6-
og_description: "MariaDB is a robust, scalable and reliable SQL Server that can serve as a drop-in replacement for MySQL. This guide shows how to install and configure it on Debian 9."
2+
slug: how-to-install-mariadb-on-debian-12
3+
title: "Installing MariaDB on Debian 12"
4+
title_meta: "How to Install MariaDB on Debian 12"
5+
description: "This guide shows how to install and configure the MariaDB server on Debian 12."
6+
og_description: "MariaDB is a robust, scalable and reliable SQL Server that can serve as a drop-in replacement for MySQL. This guide shows how to install and configure it on Debian 12 (Bookworm)."
77
authors: ["Ryan Syracuse"]
88
contributors: ["Ryan Syracuse"]
9-
published: 2020-01-31
10-
keywords: ["mariadb", "Debian 9", "debian", "database", "mysql"]
9+
published: 2025-07-22
10+
keywords: ["mariadb", "Debian 12", "debian", "bookworm", "database", "mysql"]
1111
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
12-
aliases: ['/databases/mariadb/how-to-install-mariadb-on-debian-9/','/databases/mariadb/mariadb-setup-debian/']
13-
image: Installing_MariaDB_on_Debian9.png
12+
aliases: ['/databases/mariadb/how-to-install-mariadb-on-debian-12/','/databases/mariadb/mariadb-setup-debian/']
13+
image: Installing_MariaDB_on_Debian12.png
1414
external_resources:
1515
- '[MariaDB Knowledge Base](https://mariadb.com/kb/en)'
1616
- '[MariaDB FAQ](https://mariadb.com/kb/en/mariadb-mariadb-faq/)'
@@ -19,22 +19,21 @@ relations:
1919
platform:
2020
key: how-to-install-mariadb
2121
keywords:
22-
- distribution: Debian 9
22+
- distribution: Debian 12
2323
tags: ["debian","mariadb","database"]
24-
deprecated: true
24+
deprecated: false
2525
---
2626

2727
MariaDB is a fork of the popular cross-platform MySQL database management system and is considered a full [drop-in replacement](https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-features/) for MySQL. MariaDB was created by one of MySQL's original developers in 2009 after MySQL was acquired by Oracle during the Sun Microsystems merger. Today MariaDB is maintained and developed by the [MariaDB Foundation](https://mariadb.org/en/foundation/) and community contributors with the intention of it remaining GNU GPL software.
2828

29-
{{< note >}}
29+
**Note:**
3030
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with `sudo`. If you're not familiar with the `sudo` command, you can check our [Users and Groups](/docs/guides/linux-users-and-groups/) guide.
31-
{{< /note >}}
3231

3332
## Before You Begin
3433

35-
1. If you have not already done so, create a Linode account and Compute Instance. See our [Getting Started with Linode](/docs/products/platform/get-started/) and [Creating a Compute Instance](/docs/products/compute/compute-instances/guides/create/) guides.
34+
1. If you have not already done so, create a Linode account and Compute Instance. See our [Get Started](/docs/products/platform/get-started/) with Linode and [Creating a Linode (Compute Instance)](/docs/products/compute/compute-instances/guides/create/) guides.
3635

37-
1. Follow our [Setting Up and Securing a Compute Instance](/docs/products/compute/compute-instances/guides/set-up-and-secure/) guide to update your system and configure your hostname. You may also wish to set the timezone, create a limited user account, and harden SSH access.
36+
1. Follow our [Setting Up and Securing a Compute Instance](/docs/products/compute/compute-instances/guides/set-up-and-secure/) guide to update your system and configure your hostname. You can also to set the timezone, create a limited user account, and harden SSH access.
3837

3938
To check your hostname run:
4039

@@ -49,31 +48,32 @@ Install MariaDB using the package manager.
4948

5049
sudo apt install mariadb-server
5150

52-
MariaDB will bind to localhost (127.0.0.1) by default. For information on connecting to a remote database using SSH, see our [MySQL remote access guide](/docs/guides/create-an-ssh-tunnel-for-mysql-remote-access/), which also applies to MariaDB.
51+
MariaDB will bind to localhost (127.0.0.1) by default. For information on connecting to a remote database using SSH, see our [MySQL remote access](/docs/guides/create-an-ssh-tunnel-for-mysql-remote-access/) guide, which also applies to MariaDB.
5352

54-
{{< note >}}
55-
Allowing unrestricted access to MariaDB on a public IP not advised but you may change the address it listens on by modifying the `bind-address` parameter in `/etc/my.cnf`. If you decide to bind MariaDB to your public IP, you should implement firewall rules that only allow connections from specific IP addresses.
56-
{{< /note >}}
53+
**Note:**
54+
Allowing unrestricted access to MariaDB on a public IP is not advised. However, you can change the address it listens on by modifying the `bind-address` parameter in `/etc/mysql/mariahdb.conf.d/50-server.cnf`. If you decide to bind MariaDB to your public IP address, you should implement firewall rules that restrict access to specific IP addresses.
5755

5856
### MariaDB Client
5957

60-
The standard tool for interacting with MariaDB is the `mariadb` client, which installs with the `mariadb-server` package. The MariaDB client is used through a terminal using the `mysql` command.
58+
The standard tool for interacting with MariaDB is the `mariadb` client, which is installed alongside the `mariadb-server` package. You can access the MariaDB client in the terminal using the `mysql` command.
6159

6260
### Root Login
6361

64-
1. Log into MariaDB as the root user:
62+
Log into MariaDB as the root user:
6563

6664
sudo mysql -u root -p
6765

68-
1. When prompted for login credentials, hit enter. By default MariaDB will authenticate you via the **unix_socket plugin** and credentials are not required.
66+
67+
**Note:**
68+
On Debian 12, MariaDB uses the `unix_socket` plugin by default. This means that if you're logged into the system as a user with root privileges, you can press **Enter** at the password prompt and still gain access--no password is required.
6969

7070
You'll then be presented with a welcome header and the MariaDB prompt as shown below:
7171

7272
{{< output >}}
7373
MariaDB [(none)]>
7474
{{</ output >}}
7575

76-
1. To generate a list of commands for the MariaDB prompt, enter `\h`. You'll then see:
76+
To view a list of available commands, type `\h` at the prompt. You then see:
7777

7878
{{< output >}}
7979
General information about MariaDB can be found at
@@ -113,25 +113,33 @@ MariaDB [(none)]>
113113

114114
### Securing the Installation
115115

116-
1. After accessing MariaDB as the root user of your database, enable the **mysql_native_password**
117-
plugin to enable root password authentication:
116+
After accessing MariaDB as the root user, you can switch from socket-based authentication to password-based authentication by enabling the `mysql_native_password` plugin:
118117

119118
USE mysql;
120119
UPDATE user SET plugin='mysql_native_password' WHERE user='root';
121120
FLUSH PRIVILEGES;
122121
exit;
123122

124-
1. Run the `mysql_secure_installation` script to address several security concerns in a default MariaDB installation:
123+
**New in MariaDB 10.11 on Debian 12:**
124+
The `mysql_secure_installation` script now offers the option to *set a root password,** which automatically switches the authentication method from `unix_socket` to `mysql_native_password`. This is a change from earlier versions, where socket-based authentication was the default and required manual reconfiguration.
125+
126+
Next, run the `mysql_secure_installation` script to address several security concerns in a default MariaDB installation:
125127

126128
sudo mysql_secure_installation
127129

128-
You will be given the choice to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer `yes` to these options. You can read more about the script in the [MariaDB Knowledge Base](https://mariadb.com/kb/en/mariadb/mysql_secure_installation/).
130+
This script will guide you through several options, including:
131+
- Setting a root password (if you haven't already).
132+
- Removing anonymous user accounts.
133+
- Disabling remote root logins
134+
- Removing the test database
135+
136+
It's recommended that you answer `yes` to these prompts for a more secure setup (to harden your MariaDB installation against unauthorized access). You can read more about the script in the [MariaDB Knowledge Base](https://mariadb.com/kb/en/mariadb/mysql_secure_installation/).
129137

130138
## Using MariaDB
131139

132140
### Create a New MariaDB User and Database
133141

134-
1. Login to the database again. This time, if you set a password above, enter it at the prompt.
142+
1. Log in to the database again. When you're prompted to log in to MariaDB again, you should enter the password only if you previously set one during an earlier step.
135143

136144
sudo mysql -u root -p
137145

@@ -207,22 +215,24 @@ If you forget your root MariaDB password, it can be reset.
207215

208216
sudo systemctl stop mariadb
209217

210-
1. Then execute the following command which will allow the database to start without loading the grant tables or networking.
218+
1. Then execute the following command which allows the database to start without loading the grant tables or networking.
211219

212220
sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"
213221

222+
This still works in Debian 12, but it is temporary and insecure, and should only be used in emergency recovery situations.
223+
214224
1. Restart MariaDB:
215225

216226
sudo systemctl start mariadb
217227

218-
1. Login to the MariaDB server with the root account, this time without supplying a password:
228+
1. Log in to the MariaDB server with the root account, this time without supplying a password:
219229

220230
sudo mysql -u root
221231

222232
1. Use the following commands to reset root's password. Replace `password` with a strong password:
223233

224234
FLUSH PRIVILEGES;
225-
UPDATE mysql.user SET password = PASSWORD('password') WHERE user = 'root';
235+
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';
226236
exit;
227237

228238
1. Revert the environment settings to allow the database to start with grant tables and networking:

terraform_my_demo/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.tfstate
2+
*.tfvars
3+
.terraform/

terraform_my_demo/.terraform.lock.hcl

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
terraform {
2+
required_providers {
3+
linode = {
4+
source = "linode/linode"
5+
version = "3.0.0"
6+
}
7+
}
8+
}
9+
10+
provider "linode" {
11+
token = "191ad570c7a19f0ba4cb67edadb9d897208ea3f77ce1803848330aa7e54ec057"
12+
}
13+
14+
resource "linode_instance" "terraform-web" {
15+
image = "linode/ubuntu24.04"
16+
label = "Terraform-Web-Example"
17+
group = "Terraform"
18+
region = "us-east"
19+
type = "g6-standard-1"
20+
authorized_keys = [ "YOUR_PUBLIC_SSH_KEY" ]
21+
root_pass = "YOUR_ROOT_PASSWORD"
22+
}

0 commit comments

Comments
 (0)