</>CodeWithKarani
All of Databases
Databases

MySQL & MariaDB

InnoDB, collations, packet limits and the MySQL family's sharp edges.

19 articles

Databases8 min read

Find the Query Killing Your ERPNext: A MariaDB Slow Query Log Playbook

Your ERP is slow and three queries are responsible. Configure the MariaDB slow query log properly, run pt-query-digest, and read the numbers that tell you whether it is an index problem or a hardware problem.

Read
Databases9 min read

Indexes That Actually Work: A Field Guide to tabGL Entry and tabStock Ledger Entry

ERPNext ships mostly single-column indexes, which are the wrong shape for the reports killing your server. Real EXPLAIN output, the leftmost prefix rule, key_len maths, and the composite indexes that fix ERP reports.

Read
Databases8 min read

bench backup Is Not a Backup Strategy: Binlogs and Point-in-Time Recovery for ERPNext

A nightly dump means losing a full day of invoices. Set up mariadb-backup plus binary logs, then walk a real recovery: finding the binlog position of a bad bulk cancel and replaying up to the second before it.

Read
Databases8 min read

Your ERPNext Database Hit 40GB: What to Delete, Archive, and Partition

On most large ERPNext sites the real business data is under 20 percent of the total size. Measure the tables, gut the log bloat, chunk your deletes, understand the partitioning trap, and actually reclaim the disk.

Read
Databases10 min read

MySQL error 1213 deadlock found: retry it, you cannot prevent it

Error 1213 is InnoDB breaking a lock cycle on purpose, not a bug you can configure away. How to read the real deadlock, fix lock ordering, and retry the transaction correctly.

Read
Databases8 min read

MySQL server has gone away: four unrelated causes, one message

Errors 2006 and 2013 are a shrug, not a diagnosis. Idle timeouts, packet size, read timeouts and a crashed server all produce them, and each needs a completely different fix.

Read
Databases9 min read

MySQL 'Lock wait timeout exceeded': find the blocker, not a retry loop

Error 1205 names the wrong transaction. Here is how to find the one actually holding the lock, why the default rollback behaviour is dangerous, and the real fixes.

Read
Databases9 min read

MySQL 'Got a packet bigger than max_allowed_packet bytes': Raising It Once Is Not Enough

You raised max_allowed_packet and the import still dies. There are six independent limits across a dump and restore, and mysqldump ignores the section you edited.

Read
Databases9 min read

Slow SELECT * on InnoDB While Disk Read Speed Looks Low

A full table scan crawls at 8 MB/s on a disk that does hundreds. The answer is request size, not disk speed, and here is how to measure it in four steps.

Read
Databases7 min read

MySQL 'The table is full' (Error 1114): You Are Checking the Wrong Filesystem

ERROR 1114 names a table, but the table is rarely the problem. It is usually a full datadir, a full tmpdir, or a fixed-size InnoDB tablespace. Check storage first, in that order.

Read
Databases8 min read

MySQL 'Waiting for table metadata lock': why 'online' ALTER TABLE still isn't free

An ALTER on a busy MySQL table hangs on 'Waiting for table metadata lock' and queues every query behind it. Here is what actually holds the lock, and why online DDL still stalls at cutover.

Read
Databases9 min read

MySQL 'Illegal mix of collations' (Error 1267): The Fallout of a Half-Finished utf8mb4 Migration

MySQL error 1267 fires when a join compares columns with different collations, usually a half-done utf8mb4 migration. Unblock with COLLATE, then standardise the whole schema.

Read
Frappe/ERPNext6 min read

Frappe Custom Fields Hit MariaDB's 'max 64 keys allowed': Finding the Excess Indexes

A heavily customised Item or Customer DocType can silently pile up indexes until MariaDB refuses at 64. Here is how to list them, find the wasteful ones, and remove them safely.

Read
Frappe/ERPNext7 min read

'Table tabDefaultValue doesn't exist' on bench new-site: Finding the Real Frappe Cause

The tabDefaultValue error on bench new-site is a symptom, not the cause. The real failure is in the MariaDB log: privileges, charset, version or disk. Here is how to find it.

Read
Frappe/ERPNext6 min read

MariaDB Won't Start After a Frappe Install: unknown variable 'innodb-file-format=barracuda'

The Frappe install docs still write innodb-file-format=barracuda into my.cnf, but MariaDB 10.3.1 removed that variable. Here is why mysqld refuses to start and the exact lines to delete.

Read
Frappe/ERPNext5 min read

MariaDB Not Configured for Barracuda: the Fix Depends on Your Version

Frappe's Barracuda error suggests a my.cnf block that crashes MariaDB 10.3+ because the variable was removed. Here is the version-correct config and how to recover.

Read
Databases7 min read

MySQL 'Incorrect string value' on Emoji: Why utf8 Was Never Really UTF-8

MySQL's utf8 caps at three bytes and cannot store emoji, so four-byte characters throw Incorrect string value or truncate silently. Convert to utf8mb4 on every link.

Read
Databases6 min read

How to See Progress of a Large MySQL Import (and Where pv Lies)

mysql < dump.sql gives no progress bar or ETA. Here is the pv workaround that shows live progress, plus why it hits 100% while the import keeps running.

Read
Databases6 min read

MySQL Replication Lag: Why Seconds_Behind_Master Can Read Zero and Lie

Seconds_Behind_Source measures the relay log, not the primary, so it reads zero while your replica is minutes behind and NULL when it is broken. Here is how to see real lag.

Read