Error resolution for deny user access caused by 1045 permission errors in mariadb _mariadb

Source: Internet
Author: User

With MARIADB also have a period of time, commonly used commands and grammar, basically unchanged. More complex, such as replication, did not find any difference in root MySQL.
However, today really found that there are different places, mariadb rights Management root MySQL is not the same, MySQL can create a root account equivalent permissions of the account, but mariadb is not, writing on the different.
1,MARIADB Grant Authorized an error

MARIADB [(None)]> grant all privileges in *.* to tank@ ' 192.168.% ' identified by ' test '; 
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no) 

The same command under MySQL, execution is without any problems.
At first thought is mariadb root account and password has the problem, check after no problem.
2,mariadb and MySQL root permissions are different
look at the permissions that the root account has, mariadb and MySQL are different.

MARIADB [(None)]> show Grants\g; 
1. Row *************************** 
grants for Root@localhost:grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD  , SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, show DATABASES, SUPER, CREATE temporary tables, LOCK tables, EXECUTE,  REPLICATION SLAVE, REPLICATION 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 Root@localhost | 
+---------------------------------------------------------------------+ 
| Grant all privileges in *.* to ' root ' @ ' localhost ' with GRANT OPTION | 
+---------------------------------------------------------------------+ 
1 row in Set (0.00 sec) 

3,MARIADB is different from MySQL grant syntax
for specific purposes, please refer to: https://mariadb.com/kb/en/mariadb/grant/

MARIADB [(None)]> grant all on test.* to tank@ ' 192.168.% ' identified by ' test '; 
Query OK, 0 rows Affected (0.00 sec) 


MARIADB [(None)]> Grant Select on *.* to tank@ ' 192.168.% ' identified by ' test '; 
Query OK, 0 rows Affected (0.00 sec) 

The first command gives tank all the permissions on the test library.
The second command gives the SELECT permission for all libraries and tables to the tank
Note: All can not be used with *.*, or it will be an error.

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.