List:General Discussion« Previous MessageNext Message »
From:Manuel Arostegui Date:May 5 2014 6:34am
Subject:Re: mysql Access denied error
View as plain text  
2014-05-05 4:17 GMT+02:00 EdwardKing <zhangsc@stripped>:

> I use mysql to create a database and grant rights to a user
> hadooptest,then I use hadooptest to login mysql and use the database,but it
> failed. Why raise error after I grant rights? How to solve it? Thanks.
>
> My operation is follows:
>
> [hadoop@master ~]$ mysql -h localhost -u root -p
> Enter password:
> Welcome to the MySQL monitor.  Commands end with ; or \g.
> Your MySQL connection id is 3
> Server version: 5.5.37-log MySQL Community Server (GPL)
>
> Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights
> reserved.
>
> Oracle is a registered trademark of Oracle Corporation and/or its
> affiliates. Other names may be trademarks of their respective
> owners.
>
> Type 'help;' or '\h' for help. Type '\c' to clear the current input
> statement.
>
> mysql> create database hadooptest;
> mysql> grant all on hadooptest.* to 'hadoopuser'@'%' identified by
> '123456';
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> flush priviledges;
> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
> that corresponds to your MySQL server version for the right syntax to use
> near 'priviledges' at line 1
> mysql> flush privileges;
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> quit;
> Bye
>
> Then I use hadoopuser  with password 123456
> [hadoop@master ~]$ mysql -u hadoopuser -p
> Enter password:
> ERROR 1045 (28000): Access denied for user 'hadoopuser'@'localhost'
> (using password: YES)
>


Hello,

I assume MySQL is listening in 3306 so:
Try this:  mysql -u hadoopuser -plocalhost (or 127.0.0.1)

"%" doesn't match localhost so if you don't specify it you will be
attempting to connect via Unix Socket.
If you don't want to specify -hlocalhost all the time, just do the grant
with "@localhost" instead of "@%"

Hope this helps
Manuel.

Thread
mysql Access denied errorEdwardKing5 May 2014
  • Re: mysql Access denied errorManuel Arostegui5 May 2014
    • Re: mysql Access denied errorReindl Harald5 May 2014
      • Re: mysql Access denied errorManuel Arostegui5 May 2014
        • Re: mysql Access denied errorReindl Harald5 May 2014
          • Re: mysql Access denied errorJigal van Hemert5 May 2014
            • Re: mysql Access denied errorReindl Harald5 May 2014
          • Re: mysql Access denied errorManuel Arostegui5 May 2014
  • Re: mysql Access denied errorPeter Brawley5 May 2014
  • Re: mysql Access denied errorDivesh Kamra9 May 2014
Re: mysql Access denied errorJohan De Meersman5 May 2014
  • Re: mysql Access denied errorReindl Harald5 May 2014