{"id":203,"date":"2013-02-06T14:20:42","date_gmt":"2013-02-06T20:20:42","guid":{"rendered":"http:\/\/thenoyes.com\/littlenoise\/?p=203"},"modified":"2013-02-06T14:20:42","modified_gmt":"2013-02-06T20:20:42","slug":"default-user","status":"publish","type":"post","link":"https:\/\/thenoyes.com\/littlenoise\/?p=203","title":{"rendered":"Default user"},"content":{"rendered":"<p>It came up twice in two days: if you do not specify the user name when connecting, what gets picked?<\/p>\n<p>The manual says:<br \/>\n&#8220;On Unix, most MySQL clients by default try to log in using the current Unix user name as the MySQL user name, but that is for convenience only.&#8221;<br \/>\n<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/user-names.html\" title=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/user-names.html\">http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/user-names.html<\/a><\/p>\n<p>&#8220;The default user name is ODBC on Windows or your Unix login name on Unix.&#8221;<br \/>\n<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/connecting.html\" title=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/connecting.html\">http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/connecting.html<\/a><\/p>\n<p>Let&#8217;s be a little more specific. The relevant section of code is in libmysql\/libmysql.c<\/p>\n<p>On Linux, we check the following in this order:<br \/>\n&#8211; if (geteuid() == 0), user is &#8220;root&#8221;<br \/>\n&#8211; getlogin()<br \/>\n&#8211; getpwuid(geteuid())<br \/>\n&#8211; environment variables $USER, $LOGNAME, $LOGIN<br \/>\nIf none of those return non-NULL results, use &#8220;UNKNOWN_USER&#8221;<\/p>\n<p>On Windows:<br \/>\n&#8211; environment variable $USER<br \/>\nIf that&#8217;s not set, use &#8220;ODBC&#8221;.<\/p>\n<p>I wondered why on Windows we check $USER but not $USERNAME. I gather that it&#8217;s an ODBC thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It came up twice in two days: if you do not specify the user name when connecting, what gets picked? The manual says: &#8220;On Unix, most MySQL clients by default try to log in using the current Unix user name as the MySQL user name, but that is for convenience only.&#8221; http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/user-names.html &#8220;The default user [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-mysql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2IBF1-3h","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203"}],"version-history":[{"count":2,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}