MySQL/MariaDB root user lost privileges

Solution Verified - Updated -

Issue

  • After allowing root to login from remote location, all privileges were lost
  • Below command was used:
    CREATE USER root@'%' IDENTIFIED BY 'password';
  • When connecting to MariaDB server over network, below error message was returned:

    MariaDB [(none)]> use mysql;
    ERROR 1044 (42000): Access denied for user 'root'@'%' to database 'mysql'
    
  • When showing grants, ALL privilege was lost:

    MariaDB [(none)]> show grants for root;
    +-------------------------------------------------------------------------+
    | Grants for root@%                                                       |
    +-------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*62AB24D83318' |
    +-------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • MariaDB
  • MySQL

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content