Forum Moderators: coopster
1) shell> mysql --user=myusername --password=mypassword
Note the 2 hyphens --before user and password:
*Connection is Ok and there are shown 12 databases
2) shell> mysql --user=myusername -password=mypassword
Note the 2 hyphens --before user and 1 hyphen -before password:
*Bad connection: Error 1045 (28000): Access denied for user 'myusername'@'localhost' (using password:YES)
3) shell> mysql -user=myusername -password=mypassword
Note the 1 hyphen -before user and password:
*Bad connection: Error 1045 (28000): Access denied for user 'ser=myusername'@'localhost' (using password:YES)
4) shell> mysql -user=myusername --password=mypassword
Note the 1 hyphen -before user and 2 hyphens --before password:
*Connection is Ok and there are shown 20 databases (and not 12 like the First case). These 20 databases include all the first 12 ones.
Please does anyone say to me what are the differences and why in some case I get 12 databases and in other 20 ones? What is the "right" way to connect to MySQL directely from DOS? I guess all this have relationships with the problems I have when using PHP scripts like I posted today here:
[webmasterworld.com...]
Finally, a last question: What does exactely OLD_PASSWORD () function do? What is the difference with only PASSWORD() function? I have looked for it but I don't find an answer...
Thank you very much!
So if you connect via
--user name --password pass => you connect with user/pass
If you connect via
-user name -password pass => you connect with ser/assword to db name, pass is an error
You can connect:
--user name --password pass
OR
-uname -ppass
I have no idea why sometimes it is 20db and 12, sorry
Michal Cibor
PS. To learn more write: mysql --help
-uname -ppass
That should be
-u name -ppass
-p is special in that there is no space between it and its parameter, but other single letter parameters don't work that way.
OLD_PASSWORD vs PASSWORD
Your password gets encrypted client side. New versions of MySQL use better encryption. The problem is that the client built for old versions of MySQL will encrypt to the old standard and your connection will fail. PHP (at least through PHP4) is one such client. So when you set up user accounts that you will connect to using PHP, you must set the password using OLD_PASSWORD and then flush the privileges table.
Have we gotten all the questions yet?