Common Issues with MariaDB

Solutions to the most common issues when using MariaDB — connection errors, startup failures, replication problems, and more.

❌ Error 1045: Access denied for user

Symptom

ERROR 1045 (28000): Access denied for user 'username'@'host' (using password: YES)

Possible causes

  • Incorrect password or unknown user

  • User not allowed to connect from the specified host

  • MariaDB is not configured to accept connections from your IP address

Solutions

  1. Double-check the username and password.

  2. Run the following query to see existing users:

    SELECT user, host FROM mysql.user;
  3. Grant privileges with:

    GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
  4. Verify the bind-address in your MariaDB config (my.cnf or my.ini) allows external access.


❌ Error 2002: Can't connect to local MySQL server through socket

Symptom

Possible causes

  • MariaDB server is not running

  • The socket file does not exist or is incorrectly configured

Solutions

  1. Ensure the MariaDB service is running:

  2. Check the socket path in your my.cnf config:

  3. Restart MariaDB:


❌ MariaDB fails to start

Symptom

Service refuses to start or crashes on launch.

Possible causes

  • Corrupt config files

  • Permission issues

  • Port conflict (e.g. 3306 in use)

Solutions

  1. Check the MariaDB error logs (usually in /var/log/mysql/ or /var/log/mariadb/).

  2. Ensure data directory and files are owned by the mysql user.

  3. Confirm port 3306 is not used by another service:

  4. Fix the issue and restart the service.


❌ Replication issues

Symptom

Replication fails or slave server is out-of-sync.

Possible causes

  • Incorrect replication settings

  • Data inconsistency

  • Network problems

Solutions

  1. Verify replication settings in both master and slave configs.

  2. Use SHOW SLAVE STATUS\G to check the replication status.

  3. If needed, resync data manually or use mysqldump.

  4. Ensure both servers can communicate over the network.


❌ Permission errors

Symptom

Access denied when working with specific databases or tables.

Possible causes

  • Missing privileges

  • Improperly granted permissions

Solutions

  1. Check the user's grants:

  2. Grant the required privileges:

  3. Reconnect to apply new privileges.


If the problem persists, consult the official MariaDB documentation or open a thread on MariaDBarrow-up-right

Last updated