/r/mariadb

Photograph via snooOG

MariaDB Server is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source. Notable users include Wikipedia, WordPress.com and Google.

https://mariadb.org/

/r/mariadb

2,604 Subscribers

3

MariaDB Galera Cluster: Adding index on one database causes timeouts across all databases - need help understanding why

Hey everyone,

I'm experiencing an issue with our MariaDB Galera cluster (3 nodes) and could use some help understanding what's going on, as I'm not a DBA and my database knowledge is quite limited.

Here's the situation: Whenever someone adds an index to a table in one database, applications using completely different databases within the same cluster experience timeouts, as if they're losing connection. These timeouts usually last for the duration of the index creation (could be around 30-40 seconds on larger tables).

What's confusing me is that these databases should theoretically be separate, yet adding an index to a table in one database seems to lock or disrupt all other databases in the cluster. Applications start timing out even though they're working with entirely different databases.

I assume it has something to do with replication across the cluster, and it needing to lock it's state. Again, really not my field, so these are just assumptions after some reading.

Can someone help explain:

  1. Why could this be happening?

  2. Is this normal behavior?

  3. What could be done to prevent/fix such situations?

Would really appreciate any Insight, or any pointer in the right direction as to what I should read up on. Thanks!

2 Comments
2025/02/03
04:45 UTC

1

What secure_timestamp for replication of system-versioned-tables

I am trying to setup replication of a MariaDB that has system-versioned-tables.

My problem is figuring out what value secure_timestamp should have.

On https://mariadb.com/kb/en/server-system-variables/#secure_timestamp it says

YES - timestamp cannot deviate from the system clock. Intended to prevent tampering with system versioning history. Should not be used on replicas, as when a value based on the timestamp is inserted in statement mode, discrepancies can occur.

On https://mariadb.com/kb/en/system-versioned-tables/ it says

To mitigate this with MariaDB Replication, set the secure_timestamp system variable to YES on the replica. When set, the replica uses its own system clock when applying to the row log, meaning that the primary can retry as many times as needed without causing a conflict. The retries generate new historical rows with new values for the row_start and row_end columns.

I can also set secure_timestamp to REPLICATION(replication thread can adjust timestamp to match the primary's).

What is the correct setup if I want to allows the Primary Server to retry replication without causing conflicts?

0 Comments
2025/01/31
12:06 UTC

3

Does it still send password in cleartext by default?

I just saw a setup where Excel requests information from MariaDB though ODBC connector, which connects to local port, which is forwarded through SSH to remote VPS. Is all of that really needed to make the database connection secure in 2025?

7 Comments
2025/01/31
11:12 UTC

1

how i filter computed and non computed columns

I am unsure how to do this
I have a situation for SQL for tables

some columns are computed like counts ( task_count for example calculated by subquery) and some are noncomputed ( regular columns like id, name )
when filtering those columns
I should use HAVING for computed ones and where for noncomputed ones
afaik.

if I used HAVING for all columns it works but when doing the same query again without sort and pagination the total does not match the correct rows.

using where and having together give me unexpected empty results.
like this

AND (id LIKE ? OR name LIKE ? OR created_at LIKE ? )  HAVING group_count LIKE ? OR list_count LIKE ? OR task_count LIKE ?

sql_found_rows is great to get the count but is also not recommended.

whole query is here for clarification

https://ibb.co/dWTV6WV

0 Comments
2025/01/24
20:37 UTC

1

is it bad to use SQL_FOUND_ROWS ?

1 Comment
2025/01/24
18:54 UTC

1

Can/should server rank affect auto_rejoin?

I would like to keep a specific server remain primary, whenever possible.

I have server rank set on this server set to 'primary' and the rest as 'secondary'.

While testing, I knock out the primary and a secondary is promoted as expected.

Now when I bring the original primary back, auto_rejoin does have it join again automatically but the server remains as a replica and does not get moved back to primary.

Can/should the server with the 'primary' rank get returned to primary in the cluster?

Thanks again for the help. I've scoured the documentation and tested, but it's still not clear how this should work.

6 Comments
2025/01/21
17:40 UTC

7

Vector storage, similarity search with MariaDB and LocalAI

0 Comments
2025/01/16
17:16 UTC

9

Something Big Is Coming to MariaDB [Jan 30 @ 12 PM CST]

MariaDB product leaders will be hosting a webinar on Jan 30th at 12 PM CST. They will be discussing the next major release of MariaDB Enterprise Server and MariaDB MaxScale. You can find more details and register for the webinar as follows.

https://go.mariadb.com/GLBL-WBN-2025-01-30-WhatsnewinMariaDB-ES.html

1 Comment
2025/01/15
05:48 UTC

1

Can I trigger an async rebuild of a server using the MaxScale GUI?

I figured out how to trigger a switchover using the visualization, just drag a replica on top of the primary. But, I cannot figure out how to trigger an asynchronous rebuild of a server using the GUI interface.

Thanks!

0 Comments
2025/01/14
07:23 UTC

12

MariaDB Day @ Brussels - 01.02.2025

Dear Redditors,

For those of you who happen to be in Brussels at the beginning of February or are looking for a great idea for a tech-focused city break, MariaDB Day will take place on February 1st.

MariaDB Day events bring together the MariaDB Foundation and community to celebrate and share the latest developments in MariaDB Server.
Theme: Vectors, RAG, and everything new in MariaDB Server.

The event is free to attend. You can sign up on Meetup.
Remember to RSVP – places are limited!

1 Comment
2025/01/09
08:38 UTC

3

Setup mariadb 10 on QNAP - whats the login?

Setup on a QNAP is incredibly easy. However, I cannot seem to login from anything. I have tried to ssh, and to use DBeaver. I assume the login name is root. I have also tried admin. The only setup options on the QTS side is the password and port. I have dealt with port forwarding and such with many applications and such so I know how to do that. No matter what I try, I get this error:

https://preview.redd.it/dhhubx3aotbe1.png?width=566&format=png&auto=webp&s=3f373a5b3fdbff010fb8d117b5d6dfbce12301c9

2 Comments
2025/01/08
19:34 UTC

2

Table storage files don't get updated

I just noticed that in a database I created some months ago the individual table files still have the timestamps from their creation, ibdata1 from the last reboot some 10 days ago, and ib_logfile0 is up to date. This is a very low traffic application with just a few MB of data so maybe mariadb is just lazy moving data from ib_logfile0 to ibdata1, but why don't the actual table data files change at all?

I confirmed that by creating a new dummy table just now. The dummy.frm and dummy.ibd files are created, but any INSERT results just in ib_logfile0 being updated.

This is MariaDB 10.11.6 on a Debian 12 headless SBC on all default settings. I know that innodb_file_per_table was default ON only starting from v11, but it seems to be on by default anyway according to show variables like 'innodb_file_per_table';

2 Comments
2025/01/01
10:34 UTC

2

Trying to do anything with MariaDB but only get: certificate is not yet valid

Yesterday performed a brand new install of MariaDB 11.4.4 on Linux Mint 22 Xfce. After installation I ran /usr/bin/mysql_secure_installation like I have many times. Everything seemed to work as expected. I was able to log in to MariaDB, create a database, import a .sql file, etc.

Shut down the computer when I went to bed. This morning when trying to log in mariadb -u root -p I get the following error:

ERROR 2026 (HY000): TLS/SSL error: certificate is not yet valid

Never seen this before. I've been running MariaDB for many years, just bumping the version whenever a new install was needed, never had an issue.

Did some googling, but nothing is clear. A lot of results are trying to enforce TLS/SSL and I want to disable it, or at the very least, be able to run it locally without an error. Even simply executing mariadb in the CLI emits the error.

Oddly enough, my PhpStorm connection to the database works and I can query the database in its data viewer, so I guess it works in some capacity.

Thank you for any help.

2 Comments
2024/12/31
16:11 UTC

2

Can disable auto rejoin if all servers have failed?

I'm back with another slightly obscure MaxScale question and what is probably a pretty narrow use case.

I testing a cluster of three application servers using 2 dedicated MaxScale servers to communicate with 2 MariaDB database servers. I have auto_failover=true and auto_rejoin=true. The following scenario is what's cause me issues.

  1. MaxScale A is primary and B is replica
  2. Simulate failure on A and B is promoted to primary (very nice by the way)
  3. Simulate a failure on B and nothing works, as expected.
  4. Bring up A first, it rejoins and is made primary
  5. Bring up B, it rejoins as slave and immediately fails.

The records written on B while A was down are invisible to A when it becomes master again. This makes sense and I'm guessing the best course of action here is not to automatically rejoin A after all servers have failed. I can set auto_rejoin to false, but I'm wondering if there is a way to configure so auto_rejoin is false after we've lost track of the state of all of the servers?

3 Comments
2024/12/23
04:05 UTC

0

Can't get Mariadb and excel for mac to work

I've got homeBrew installed

I've got the MariaDB installed

I created a blank db and imported data into it

I installed the mariadb odbc connector

But I can't figure out how to make excel connect to the data.

Can anyone help

https://preview.redd.it/ftrtgaa78n7e1.jpg?width=946&format=pjpg&auto=webp&s=9dd24e418c855bbbb22dd8418ca3ba8a7d22ad63

6 Comments
2024/12/18
17:37 UTC

1

Couple of dumb questions

  • Can I setup databases in the home directory, currently they are in /var/lib/mysql Tried symlinking but cannot get it to work.

  • How do I export to, say, CSV, again in my home directory?

Both questions are about using the home not the var directory.

5 Comments
2024/12/16
18:48 UTC

2

Can a MaxScale instance prioritize reads to a specific database

So this is the basic configuration I'm working with. I have two database servers in different centers and they replicate asynchronously. I also have an app server and, possibly, a MaxScale instance, in each center. I would like to know if each MaxScale instance could prioritize reads to the database in the same data center in order to avoid the additional latency of crossing between data centers. Writes and immediate reads would be expected to hit the primary server, so that's not an issue.

https://preview.redd.it/89ggyevrfh6e1.png?width=960&format=png&auto=webp&s=1250d24347876bfcf002f786b7f2e9adddea0f6f

I've been going through the doc, but I cannot see a way to get this type of behavior.

2 Comments
2024/12/12
22:14 UTC

0

Nonroot user cannot connect to mariadb

I'm running a local ubuntu host for testing php websites.
The OS is ubuntu 22.04.
The host is running mariadb 15.

Most everything is running fine.

However, commandline operations that attempt to connect to the server fail unless the user is root.

For example, this command fails:

`mysql -uroot -proot

The error is:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

The same command succeeds if the user is root.

The error seems to indicate that a connection attempt is being made through the socket '/tmp/mysql.sock'.

This socket doesn't exist.
But also, this socket is not defined in the configuration files as far as I can tell.

In '/etc/mariadb.cnf', the connection is defined to be '/run/mysqld/mysqld.sock'.
This file exists.

I can only guess what might be happening here, and I'm not sure how to debug the issue.

Either the nonroot user is using a nonexistent mysql/maria configuration file. Or perhaps no conf file is being invoked at all, and some defaults are being used?

I'm guessing that this issue is related to the way that mariadb is installed on ubuntu.

6 Comments
2024/12/11
21:48 UTC

1

MariaDB not comparing 'YYYY-MM' strings as expected? (not the same as MySQL 5, anyway) - not sure if by design?

After moving my database from MySQL 5 to MariaDB 10.11.8 I noticed some queries were misbehaving. It turns out that if you do a comparison of this kind:

SELECT * FROM orders WHERE date>'2024-01'

On MySQL 5 it would do a string comparison and return the expected result - all orders placed after 00:00 on 1st of January 2024. But with MariaDB, it returns all orders. If I changed the criterion to date>'2024-01-01', then it works as before.

Googling failed me, so I just wondered anyone knew what exactly MariaDB is doing.

3 Comments
2024/12/11
20:30 UTC

1

Galera cluster and nvme drive PLP

Hi,

How big difference does a nvme PLP make for the performance of the galera cluster?
If not considering about the data loss without PLP or a consumer nvme not able to sustain a constant write speed, how much just the PLP feauter improves performance or does it at all?

Has fsync something to do with PLP and a performance increase?

0 Comments
2024/12/11
13:55 UTC

2

MySQL to MariaDB manual copy

I had a cPanel server that was outdated and running an older MySQL. I got a new one but it has MariaDB. MySQL failed on the original server, so I couldn’t properly do an export and import. Instead, all I could do was download the /var/lib/mysql directory and upload the database files to the new server, and as expected, there are a variety of problems.

I’m not a database expert. Is there something simple I’m missing here, or do I need to do things differently?

My home computer is Linux, so I’m thinking the easiest solution would be to put the database files on my computer and install MySQL, then use it to properly export then import to the new server, but I can’t get MySQL working on my computer. Would that work if I can get MySQL working on my computer?

10 Comments
2024/12/09
00:01 UTC

1

Mariadb: How to display 'formatted' Table records from Linux Terminal?

Running Linux Mint running Apache2 with MariaDB and PHP installed and working\

I have a...
Database Named: TestDB and a Table Named: tblMembers...

The Question:
After opening the database from the Linux terminal..
How to display the records in tblMembers... in a formatted fashion maybe like...

Member_ID: 1
Member_Name: John Doe
Member_Address: 101 Main Street
Member_Email: JDoe@xyz.com
Member_Phone: 555-555-5555

Member_ID: 2
Member_Name: Mary Poppins
Member_Address: 102 2nd Ave
Member_Email: Mary@abcd.com
Member_Phone: 555-555-1234

etc?

SELECT Member_Name FROM tblMembers; //works but only one field from the record

SELECT * FROM tblMembers: //works but is unformatted

Thanks for any help as Its been a long time since I've done this and I'm "Googled out"

2 Comments
2024/12/08
17:29 UTC

1

Can MySQL Group Replication be used in MariaDB

I dont see any documentation on MariaDB's site mentioning group replication. It only talks about Galera Clusters. Am I missing something?

2 Comments
2024/12/05
10:46 UTC

2

Which proxy to use with MySQL group replication

We are planning to shift to single primary replication for our MariaDB database with either 3 or 5 nodes. I want to know what architecture should suit us and which proxy to use. There seem to be a lot of options like HAProxy, ProxySQL, MySQL Router etc. I want one with the best performance and ease of use.

20 Comments
2024/12/04
21:12 UTC

1

Macos + launchd + python + mariadb = server connection fail

Hello. I am new to this group. Hopefully someone can provide some guidance to solve my issue... I am attempting to schedule the running of my python program on my Mac using launchd.

I have hit a roadblock using launchd to periodically start a python script that collects some data from the mac locally (file based data), then connect to a remote mariadb server and insert the data to the appropriate tables. When I run the python program manually (without launchd), it works perfectly. When I run the python program with launchd, it runs creates my log file, imports the appropriate packages, etc. When it attempts to connect to the remote db server, it fails.

2024-12-04 08:55:00 -- PROCESS START - connecting to database
2024-12-04 08:55:00 -- Error: Can't connect to server on '192.168.1.3' (65)
2024-12-04 08:55:00 -- PROCESS END - terminating

The error above comes from the python code:

try:
    conn = mariadb.connect(
        user="user",
        password="password",
        host="192.168.1.3",
        port=3306,
        database="my_database"
    )

except mariadb.Error as e:
    print(f"Error: {e}")
    errorText = f"Error: {e}"
    log_write(errorText)

My launchd was configured using the following plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.ccg.launchphotofileminer</string>

  <key>ProgramArguments</key>
  <array>
    <string>/Users/ccg/MyLaunchAgents/launch-photo-miner</string>
  </array>

  <key>Nice</key>
  <integer>1</integer>

 <key>StartCalendarInterval</key>
 <dict>
   <key>Minute</key>
   <integer>55</integer>
 </dict>

  <key>RunAtLoad</key>
  <false/>

  <key>WorkingDirectory</key>
  <string>/Users/ccg/MyLaunchAgents</string>

  <key>StandardErrorPath</key>
  <string>/Users/ccg/MyLaunchAgents/photofileminer.err</string>

  <key>StandardOutPath</key>
  <string>/Users/ccg/MyLaunchAgents/photofileminer.out</string>
</dict>
</plist>

The plist calls a bash script which sets up the python environment and then launches the python code:

source ~/.venv/bin/activate
cd /Users/ccg/MyLaunchAgents
/Users/ccg/.venv/bin/python3  > /Users/ccg/MyLaunchAgents/photo.log 2>&1photo-file-miner.py

System details:

  • Intel based Mac running 15.1.1
  • Python 3.12 installed via BREW
  • Mariadb connector installed via PIP3

I have used the same bash script as a launcher for cron in place of launchd and I get the exact same errors.

Any thoughts or guidance?

1 Comment
2024/12/04
16:28 UTC

1

Update query doesn't work

I have a simple update query of which I get error, saying that there is something wrong with my syntax, but I have noe idea what it could be:

$sql = "UPDATE Leela SET Group = '$Groupname', Color = '$Brickcolor' WHERE Id = '$Id'";

if (!mysqli_query($conn, $sql)) {

echo "Error: 1010, contact technical support" . $sql . "<br>" . mysqli_error($conn);

}

In the database:

Group: varchar(18)

Color: char(1)

Id: bigint(12) auto increment

Thanks in advance.

7 Comments
2024/12/02
12:27 UTC

Back To Top