From c5d5ea9b3672cd3ce9798458947d4d20d4fceef7 Mon Sep 17 00:00:00 2001 From: Dianna Hoober Date: Wed, 23 Jul 2025 10:34:13 -0700 Subject: [PATCH 1/5] updates to version --- .vscode/settings.json | 3 +- ...png => Installing_MariaDB_on_Debian12.png} | Bin .../index.md | 72 ++++++++++-------- terraform_my_demo/.gitignore | 3 + terraform_my_demo/.terraform.lock.hcl | 24 ++++++ terraform_my_demo/linode-terraform-web.tf | 22 ++++++ 6 files changed, 92 insertions(+), 32 deletions(-) rename docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/{Installing_MariaDB_on_Debian9.png => Installing_MariaDB_on_Debian12.png} (100%) create mode 100644 terraform_my_demo/.gitignore create mode 100644 terraform_my_demo/.terraform.lock.hcl create mode 100644 terraform_my_demo/linode-terraform-web.tf diff --git a/.vscode/settings.json b/.vscode/settings.json index 620a53aa4a0..584ced7291b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "git.autorefresh": false + "git.autorefresh": false, + "powershell.pester.codeLens": false } \ No newline at end of file diff --git a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/Installing_MariaDB_on_Debian9.png b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/Installing_MariaDB_on_Debian12.png similarity index 100% rename from docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/Installing_MariaDB_on_Debian9.png rename to docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/Installing_MariaDB_on_Debian12.png diff --git a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md index ef423d0d9b3..b69cb3c2e63 100644 --- a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md +++ b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md @@ -1,16 +1,16 @@ --- -slug: how-to-install-mariadb-on-debian-9 -title: "Installing MariaDB on Debian 9" -title_meta: "How to Install MariaDB on Debian 9" -description: "This guide shows how to install and configure the MariaDB server on Debian 9." -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." +slug: how-to-install-mariadb-on-debian-12 +title: "Installing MariaDB on Debian 12" +title_meta: "How to Install MariaDB on Debian 12" +description: "This guide shows how to install and configure the MariaDB server on Debian 12." +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)." authors: ["Ryan Syracuse"] contributors: ["Ryan Syracuse"] -published: 2020-01-31 -keywords: ["mariadb", "Debian 9", "debian", "database", "mysql"] +published: 2025-07-22 +keywords: ["mariadb", "Debian 12", "debian", "bookworm", "database", "mysql"] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' -aliases: ['/databases/mariadb/how-to-install-mariadb-on-debian-9/','/databases/mariadb/mariadb-setup-debian/'] -image: Installing_MariaDB_on_Debian9.png +aliases: ['/databases/mariadb/how-to-install-mariadb-on-debian-12/','/databases/mariadb/mariadb-setup-debian/'] +image: Installing_MariaDB_on_Debian12.png external_resources: - '[MariaDB Knowledge Base](https://mariadb.com/kb/en)' - '[MariaDB FAQ](https://mariadb.com/kb/en/mariadb-mariadb-faq/)' @@ -19,22 +19,21 @@ relations: platform: key: how-to-install-mariadb keywords: - - distribution: Debian 9 + - distribution: Debian 12 tags: ["debian","mariadb","database"] -deprecated: true +deprecated: false --- 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. -{{< note >}} +**Note:** 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. -{{< /note >}} ## Before You Begin -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. +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. -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. +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. To check your hostname run: @@ -49,23 +48,24 @@ Install MariaDB using the package manager. sudo apt install mariadb-server -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. +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. -{{< note >}} -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. -{{< /note >}} +**Note:** +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. ### MariaDB Client -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. +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. ### Root Login -1. Log into MariaDB as the root user: +Log into MariaDB as the root user: sudo mysql -u root -p -1. When prompted for login credentials, hit enter. By default MariaDB will authenticate you via the **unix_socket plugin** and credentials are not required. + +**Note:** + 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. You'll then be presented with a welcome header and the MariaDB prompt as shown below: @@ -73,7 +73,7 @@ The standard tool for interacting with MariaDB is the `mariadb` client, which in MariaDB [(none)]> {{}} -1. To generate a list of commands for the MariaDB prompt, enter `\h`. You'll then see: +To view a list of available commands, type `\h` at the prompt. You then see: {{< output >}} General information about MariaDB can be found at @@ -113,25 +113,33 @@ MariaDB [(none)]> ### Securing the Installation -1. After accessing MariaDB as the root user of your database, enable the **mysql_native_password** -plugin to enable root password authentication: +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: USE mysql; UPDATE user SET plugin='mysql_native_password' WHERE user='root'; FLUSH PRIVILEGES; exit; -1. Run the `mysql_secure_installation` script to address several security concerns in a default MariaDB installation: +**New in MariaDB 10.11 on Debian 12:** +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. + +Next, run the `mysql_secure_installation` script to address several security concerns in a default MariaDB installation: sudo mysql_secure_installation -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/). +This script will guide you through several options, including: + - Setting a root password (if you haven't already). + - Removing anonymous user accounts. + - Disabling remote root logins + - Removing the test database + +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/). ## Using MariaDB ### Create a New MariaDB User and Database -1. Login to the database again. This time, if you set a password above, enter it at the prompt. +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. sudo mysql -u root -p @@ -207,22 +215,24 @@ If you forget your root MariaDB password, it can be reset. sudo systemctl stop mariadb -1. Then execute the following command which will allow the database to start without loading the grant tables or networking. +1. Then execute the following command which allows the database to start without loading the grant tables or networking. sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking" +This still works in Debian 12, but it is temporary and insecure, and should only be used in emergency recovery situations. + 1. Restart MariaDB: sudo systemctl start mariadb -1. Login to the MariaDB server with the root account, this time without supplying a password: +1. Log in to the MariaDB server with the root account, this time without supplying a password: sudo mysql -u root 1. Use the following commands to reset root's password. Replace `password` with a strong password: FLUSH PRIVILEGES; - UPDATE mysql.user SET password = PASSWORD('password') WHERE user = 'root'; + ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password'; exit; 1. Revert the environment settings to allow the database to start with grant tables and networking: diff --git a/terraform_my_demo/.gitignore b/terraform_my_demo/.gitignore new file mode 100644 index 00000000000..37c7aea3278 --- /dev/null +++ b/terraform_my_demo/.gitignore @@ -0,0 +1,3 @@ +*.tfstate +*.tfvars +.terraform/ \ No newline at end of file diff --git a/terraform_my_demo/.terraform.lock.hcl b/terraform_my_demo/.terraform.lock.hcl new file mode 100644 index 00000000000..2c0bfee8f8b --- /dev/null +++ b/terraform_my_demo/.terraform.lock.hcl @@ -0,0 +1,24 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/linode/linode" { + version = "3.0.0" + constraints = "3.0.0" + hashes = [ + "h1:VSSbu1DSZx4FUREi8ZP9CwX+73Y+IR9UuszP1af35WM=", + "zh:27d54c350deca6a2175c3aa3c1a1900ee1ef67860ca3ab02ffe342eb78555290", + "zh:42c63cb0ba03d82adbcc7fee57e9ac663887cdbdbc2a56e6bd94f884b4559c47", + "zh:5a4f5e51d6a98f8725e5f7df1d1ad74b6db1bdec4abe7cd450851a68aa778626", + "zh:62a5b78ee803dfdce3673463232cfde7b25fc47a2d57892b8d7940cf83c30743", + "zh:67fa9b211eca888c8bd9ba8dec170da7fee581b5e4e71b1331f702b85eb65541", + "zh:6aabe1076ce38a24b7b031cd97175aa968e3f0df996c3c1ef967b5f4f60cf77b", + "zh:8523e14fb7142e813f3a75a47d621a5989df85de486498792d50e33b9297fe78", + "zh:a5107ef75fc8914a6450ae98355f87a51435d8e5d6ec8d3c2e38f69f490cae65", + "zh:a9db103422438b15b1181eb8b0b58a243583a6f4652d6aedbc754c5200a60376", + "zh:d50b063fb6c1e1afa2d578cf1ada1cc307fdf37a44526af654504738916ade07", + "zh:d8c817948193abcada82c504cc9b31b929f9cadf12f253db55f6cef8b13f81fc", + "zh:db51b80e6b7cdde11d45ad5d8a404a5dd98434e0ac370e41b96280a601fd1ebf", + "zh:e18db22d0a8cef5db4cc2dab7c491d10550071c9fcca5570af35622b151b09b8", + "zh:fc5c305a810653c627f6dfb8037f6aa6ef2651d2661d035e9154cdc0694076e0", + ] +} diff --git a/terraform_my_demo/linode-terraform-web.tf b/terraform_my_demo/linode-terraform-web.tf new file mode 100644 index 00000000000..b270f05c1f1 --- /dev/null +++ b/terraform_my_demo/linode-terraform-web.tf @@ -0,0 +1,22 @@ +terraform { + required_providers { + linode = { + source = "linode/linode" + version = "3.0.0" + } + } +} + +provider "linode" { + token = "191ad570c7a19f0ba4cb67edadb9d897208ea3f77ce1803848330aa7e54ec057" +} + +resource "linode_instance" "terraform-web" { + image = "linode/ubuntu24.04" + label = "Terraform-Web-Example" + group = "Terraform" + region = "us-east" + type = "g6-standard-1" + authorized_keys = [ "YOUR_PUBLIC_SSH_KEY" ] + root_pass = "YOUR_ROOT_PASSWORD" +} \ No newline at end of file From 97afc21e15bd61525b4b70d1cb6e37a5fd13f453 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 28 Jul 2025 16:30:31 -0700 Subject: [PATCH 2/5] Update index.md Looked for trailing white space and followed instructions for removing it. Didn't really find any. --- .../mariadb/how-to-install-mariadb-on-debian-9/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md index b69cb3c2e63..43323208354 100644 --- a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md +++ b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md @@ -174,7 +174,6 @@ It's recommended that you answer `yes` to these prompts for a more secure setup - Two other fields are created, `first_name` and `last_name` for storing the customer's name. 1. View the new table: - SHOW TABLES; {{< output >}} @@ -245,4 +244,4 @@ This still works in Debian 12, but it is temporary and insecure, and should only 1. You should now be able to log into the database with your new root password: - sudo mysql -u root -p \ No newline at end of file + sudo mysql -u root -p From e90160ef41cf8668d4bd95dace1abfaa1ff08cbf Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Mon, 28 Jul 2025 16:35:36 -0700 Subject: [PATCH 3/5] Update index.md Still trying to remove trailing whitespaces. From f63c39976314c29e69d30e1dc09dd9a102d20563 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Tue, 29 Jul 2025 12:09:43 -0700 Subject: [PATCH 4/5] Update index.md Minor grammar changes in intro, last sentence. --- .../mariadb/how-to-install-mariadb-on-debian-9/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md index 43323208354..4a0409fd654 100644 --- a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md +++ b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md @@ -24,7 +24,7 @@ tags: ["debian","mariadb","database"] deprecated: false --- -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. +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 that it remain GNU GPL software. **Note:** 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. From f65ebfcd08790ad5ebb58582d0c795b20ea286e1 Mon Sep 17 00:00:00 2001 From: DHBR2 Date: Tue, 29 Jul 2025 15:36:37 -0700 Subject: [PATCH 5/5] Update index.md Included more info for the reset password note. --- .../mariadb/how-to-install-mariadb-on-debian-9/index.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md index 4a0409fd654..219a99820ba 100644 --- a/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md +++ b/docs/guides/databases/mariadb/how-to-install-mariadb-on-debian-9/index.md @@ -6,7 +6,7 @@ description: "This guide shows how to install and configure the MariaDB server o 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)." authors: ["Ryan Syracuse"] contributors: ["Ryan Syracuse"] -published: 2025-07-22 +published: 2020-01-30 keywords: ["mariadb", "Debian 12", "debian", "bookworm", "database", "mysql"] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' aliases: ['/databases/mariadb/how-to-install-mariadb-on-debian-12/','/databases/mariadb/mariadb-setup-debian/'] @@ -51,7 +51,7 @@ Install MariaDB using the package manager. 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. **Note:** -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. +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/mariadb.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. ### MariaDB Client @@ -218,7 +218,8 @@ If you forget your root MariaDB password, it can be reset. sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking" -This still works in Debian 12, but it is temporary and insecure, and should only be used in emergency recovery situations. +**Note:** +This method disables grant tables and networking. While it still works in Debian 12, it is temporary and insecure--use only in emergency recovery situations. 1. Restart MariaDB: