Error
Error Code: 1103

MariaDB Error 1103: Invalid Table Name Specified

📦 MariaDB
📋

Description

MariaDB Error 1103 indicates that a SQL statement references a table name that is either syntactically incorrect, does not exist in the current database, or is inaccessible. This typically occurs during DDL or DML operations when the specified table name doesn't match an existing table or violates MariaDB's naming rules.
💬

Error Message

Incorrect table name '%s'
🔍

Known Causes

4 known causes
⚠️
Table Does Not Exist
The most common cause is attempting to reference a table that has not been created in the current database or schema.
⚠️
Typographical Error
A simple spelling mistake or incorrect capitalization in the table name within the SQL query will lead to this error.
⚠️
Wrong Database Selected
The table might exist, but the current session or query is operating within a different database where the table is not present.
⚠️
Invalid Naming Convention
The table name might contain special characters, start with a number, or clash with MariaDB's reserved keywords, violating naming rules.
🛠️

Solutions

3 solutions available

1. Correct Invalid Table Name in SQL Statement easy

Identify and fix the table name in your SQL query that is causing the error.

1
Examine the SQL statement that triggered the error. Look for the table name that is enclosed in `%s` in the error message.
2
Verify that the table name is spelled correctly and adheres to MariaDB's naming conventions (e.g., no leading/trailing spaces, allowed characters).
3
If the table name is enclosed in backticks (`) and contains special characters or is a reserved word, ensure it's correctly escaped.
SELECT * FROM `my-table-name`;
4
Correct the table name in your SQL query and re-execute it.
SELECT * FROM your_correct_table_name;

2. Inspect Table Existence and Schema medium

Confirm that the table actually exists in the database and check its name in the schema.

1
Connect to your MariaDB server using a client like `mysql` or MariaDB Workbench.
2
Select the correct database if you haven't already.
USE your_database_name;
3
List all tables in the current database to visually inspect the table names.
SHOW TABLES;
4
Alternatively, query the information schema to find the table.
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'your_database_name' AND TABLE_NAME LIKE '%your_suspected_table_name%';
5
Compare the table name from your SQL statement with the names listed in the output. Correct any discrepancies.

3. Check for Case Sensitivity Issues medium

Address potential table name case sensitivity problems, especially on case-sensitive file systems.

1
Determine your MariaDB server's `lower_case_table_names` setting. This setting controls how table names are stored and compared.
SHOW VARIABLES LIKE 'lower_case_table_names';
2
If `lower_case_table_names` is 0 (case-sensitive), ensure the table name in your query exactly matches the case of the table name in the database.
3
If `lower_case_table_names` is 1 (case-insensitive on disk, stored lowercase), ensure your query uses the lowercase version of the table name.
4
If `lower_case_table_names` is 2 (case-insensitive on disk, stored as given), ensure your query matches the case as it was created.
5
If you encounter consistent case-related issues and your `lower_case_table_names` is not set to a suitable value for your needs, consider altering it (requires server restart). For most cross-platform compatibility, setting it to 2 is often recommended.
ALTER GLOBAL VARIABLE lower_case_table_names=2;
6
After adjusting the setting, restart your MariaDB server and re-test your query.
🔗

Related Errors

5 related errors