What's is difference between changing MySQL user password with and without -h option
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What's is difference between changing MySQL user password with and without -h option
I have observed that for normal (other than root) user changing password with and without -h option has different effect. If password is changed without -h, then the commands used with -h did not pick new password. They still uses old password.
Also I am not able to connect to MySQL instance using -h option with root user. I am using MySQL Ver 14.14 Distrib 5.6.21, for Linux (x86_64) using EditLine wrapper
I am trying below command,
Quote:
[test@test ~]$ mysql -uroot -ptest -h 192.168.209.117
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'test' (using password: YES)
Output of "SHOW GRANTS"
Quote:
mysql> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
I have observed that for normal (other than root) user changing password with and without -h option has different effect. If password is changed without -h, then the commands used with -h did not pick new password. They still uses old password.
Also I am not able to connect to MySQL instance using -h option with root user. I am using MySQL Ver 14.14 Distrib 5.6.21, for Linux (x86_64) using EditLine wrapper
I am trying below command,
Output of "SHOW GRANTS"
Default host for -h is "localhost". You can have different permissions/passwords depending where you connect from/to.
1.How to enable root user to connect through "-h 192.168.209.117" option.
2.Do I need to reset user password with and without -h option through mysqladmin command.
1.How to enable root user to connect through "-h 192.168.209.117" option.
2.Do I need to reset user password with and without -h option through mysqladmin command.
I usually do such things with phpmyadmin, but you basically login with the account which works and change the password for user root@192.168.209.117 like this
Code:
SET PASSWORD FOR 'root'@'192.168.209.117' = PASSWORD('cleartext password');
Sorry but I am not getting you. I am trying to reset password in shell script through 'mysqladmin' command. If I use -h in mysqladmin, new password is effective only for 'mysql' commands used with -h.
I am connecting to mysql from that server itself.
Thanks for suggestions. I will try them out and update.
However my doubt is, does root user not allowed to login through Ip address from command line?
Your MySQL users can login only accourdng to the GRANTs given them.
GRANTs for same name but different hosts (IP) are different users as far as MySQL is concerned. Changing password for one has no effect on any other.
And root@anywhere is just another MySQL user and carries no inherent privileges or restrictions - only what is in the GRANT table. Do not confuse a MySQL user named root with system root user - they are not related in any way.
Query is successful but there is no grants are not updated. Also access issue not fixed.
The command(s) you used is not the same as in post 5. PASSWORD means literally PASSWORD whereas <password> means the password. Please try again exactly like written in post 5.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.209.117' IDENTIFIED BY PASSWORD 'XXXX' WITH GRANT OPTION ; flush privileges; exit;
ERROR 1827 (HY000): The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.
Query OK, 0 rows affected (0.00 sec)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.