How to Show Users in MariaDB (List Accounts, Grants, Sessions)

Show users in MariaDB account report query and output in VS Code

Someone asks who can log in to your database server, and you need the list today. To show users in MariaDB, run SELECT User, Host FROM mysql.user; because MariaDB has no SHOW USERS statement. We’ll build that one query into a small account report, then check what each account can do and who’s connected right … Read more >>

MariaDB vs PostgreSQL: 7 SQL Differences Tested on One Table

MariaDB vs PostgreSQL: PostgreSQL 18 rolling back a CREATE TABLE inside a transaction

Use MariaDB when you’re moving off MySQL or running a read-heavy web app that already speaks its SQL. Use PostgreSQL when data correctness, JSON queries or complex SQL matter more than easy migration. That’s my MariaDB vs PostgreSQL rule of thumb, and I’d pick PostgreSQL for a new project. The reason isn’t speed. It’s that … Read more >>

MariaDB Remove User: DROP USER, Grants and ERROR 1396

MariaDB remove user with DROP USER naming the host in VS Code

The account is sitting right there in mysql.user, and MariaDB still refuses: Error: I’d left off the host, so MariaDB went looking for ‘ru_tyler’@’%’, and mine was @’localhost’. Quick answer: to handle a MariaDB remove user job, name the full account: DROP USER ‘name’@’host’; Tested on MariaDB 13.0.2, Windows 11. What You Need Before You … Read more >>

How to Show Tables in MariaDB: SHOW TABLES, Size, Locks and More

MariaDB SHOW FULL TABLES output run in VS Code

To show tables in MariaDB, pick a database and run SHOW TABLES: Tested on MariaDB 13.0.2 on Windows 11. Sample Tables for the Examples Three tables, a view and a sequence. The tables are plain CREATE TABLE in MariaDB statements: Version check: MariaDB SHOW TABLES Syntax On the sample database: Five rows, view and sequence … Read more >>

MariaDB See If Table Exists

MariaDB see if table exist

In MariaDB, the SHOW TABLES and SHOW TABLE STATUS statements are used to retrieve information about the tables in a database. The SHOW TABLES statement lists the names of the tables in a database, while the SHOW TABLE STATUS statement returns detailed information about the tables, such as the engine, row format, and data size. … Read more >>

MariaDB INSERT INTO: Syntax, Examples and Common Errors

MariaDB INSERT INTO with RETURNING in VS Code

Say a new Denver customer signs up and you need her in your customers table. The MariaDB INSERT INTO statement adds that row: INSERT INTO customers (full_name, email) VALUES (‘Hannah Brooks’, ‘hannah@example.com’); You name the columns, then give one value per column. Tested on MariaDB 13.0.2, Windows 11. The Sample customers Table We’ll Use All … Read more >>

MariaDB SELECT UNIQUE vs DISTINCT: Count, Dates, JSON, GROUP BY

MariaDB SELECT UNIQUE and SELECT DISTINCT on a charity gifts table, run in VS Code

If you’ve copied SELECT UNIQUE from an Oracle script, you probably expected an error. On my MariaDB 13.0.2 it ran, in the default sql_mode. My verdict on MariaDB select unique: write SELECT DISTINCT state FROM gifts;. UNIQUE is a documented Oracle-mode synonym, and MySQL 8.4 rejected it with ERROR 1064. Tested on MariaDB 13.0.2 (Windows), … Read more >>

MariaDB CHECK Constraint: Add, Drop, Show and Fix ERROR 4025

MariaDB CHECK constraint ERROR 4025 run in VS Code

A MariaDB check constraint rejects any row whose expression is false. My negative park pass fee died with ERROR 4025 (23000). Quick answer: add CHECK (fee >= 0) to a column, or a named rule to the table: Test setup: MariaDB 13.0.2 on Windows 11, InnoDB, mariadb client. Outputs are real. MariaDB CHECK Constraint Syntax: … Read more >>

MariaDB Check String Length: LENGTH vs CHAR_LENGTH

MariaDB LENGTH vs CHAR_LENGTH on accented customer names in VS Code

For a MariaDB check string length query, use CHAR_LENGTH() for characters and LENGTH() for bytes. They only agree on plain ASCII: Tested on MariaDB 13.0.2, default utf8mb4. The ë takes 2 bytes, the cactus 4. Sample Table for the Length Examples Five US customers loaded with one multi-row INSERT: two accented names, a ZIP+4, an … Read more >>