Edward , use following way mysql -uroot -p -h{host ip }
else give grant privileges to localhost On Mon, May 5, 2014 at 7:47 AM, EdwardKing <zhan...@neusoft.com> wrote: > 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) > > > > --------------------------------------------------------------------------------------------------- > Confidentiality Notice: The information contained in this e-mail and any > accompanying attachment(s) > is intended only for the use of the intended recipient and may be > confidential and/or privileged of > Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader > of this communication is > not the intended recipient, unauthorized use, forwarding, printing, > storing, disclosure or copying > is strictly prohibited, and may be unlawful.If you have received this > communication in error,please > immediately notify the sender by return e-mail, and delete the original > message and all copies from > your system. Thank you. > > --------------------------------------------------------------------------------------------------- >