Forum Moderators: coopster

Message Too Old, No Replies

Differences between -user and - - user

I can connect to MySQL but have diferent number of databases

         

percy05

8:03 pm on Aug 12, 2005 (gmt 0)

10+ Year Member



Hello, other question please: What is the difference in using -user/password and ---user/password when connecting to MySQL 4.1.10.a? I connect writing in DOS shell>mysqld.exe (Daemon - and not mysql.exe because it does not work but I do not why if manuals say it should be with mysql.exe). Then there are 4 different cases to do to connect:

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!

percy05

5:42 am on Aug 13, 2005 (gmt 0)

10+ Year Member



Please can anyone help with this?

mcibor

1:25 pm on Aug 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know how is it in your case, but:
one hyphen = one letter
two hyphens = keyword

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

ergophobe

3:37 pm on Aug 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




-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?

percy05

8:10 pm on Aug 16, 2005 (gmt 0)

10+ Year Member



Thanks a lot Mcibor and Ergophobe for your valious help. I am reading ALL the MySQL manual and have found many interesting things. Thanks a lot again! Percy