Fix MARIADB Grant ERROR 1045 (28000): Access denied for user

Source: Internet
Author: User

Let's take a look at a solution to MARIADB Grant ERROR 1045 (28000): Access denied for user issues, hopefully the article will help you friends.  

With MARIADB also has a period of time, commonly used command and grammar, basically unchanged. More complicated, such as replication, and there is no difference between the root MySQL found.

However, today really found that there are different places, mariadb rights Management root MySQL is not the same, MySQL can create a root account with the same privileges of the account, but mariadb is not, the wording is also different.

1,MARIADB Grant Authorization Error

MariaDB [(None)]> grant all privileges on * * to [e-mail protected] ' 192.168.% ' identified by ' test ';
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

The same command under MySQL, execution is no problem.
At first thought is mariadb root account and password has a problem, after checking no problem.

2,mariadb differs from MySQL root permissions

looking at the permissions that the root account has, mariadb and MySQL are not the same.
   
MariaDB [(None)]> show Grants\g;
*************************** 1. Row ***************************
Grants for [email protected]: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REF Erences, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE temporary TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, Replicatio N CLIENT, create VIEW, SHOW view, create ROUTINE, ALTER ROUTINE, create USER, EVENT, TRIGGER on * * to ' root ' @ ' localhost ' With GRANT OPTION
1 row in Set (0.00 sec)
  
error:no Query specified
   
mysql> Show grants;
+---------------------------------------------------------------------+  
|  Grants for [email protected] |
+---------------------------------------------------------------------+  
|  GRANT all privileges on * * to ' root ' @ ' localhost ' with GRANT OPTION |
+---------------------------------------------------------------------+  
1 row in Set (0.00 sec)

3,MARIADB differs from MySQL grant syntax

specific to the FA, please refer to: https://mariadb.com/kb/en/mariadb /grant/
mariadb [(None)]> grant all on test.* to [email  protected] ' 192.168.% ' identified by ' test ';   
query OK, 0 rows Affected (0.00 sec)   
  
mariadb [(None)]> Grant select on * to [email protected] ' 192.168.% ' identified by ' test ';   
query OK, 0 rows Affected (0.00 sec)  

The first command, give all permissions to the test library to tank
The second command, give the SELECT permission for all libraries and tables to tank
Note: All cannot be used with *. *, otherwise it will be an error.

Fix MARIADB Grant ERROR 1045 (28000): Access denied for user

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.