{"id":418,"date":"2013-10-16T17:11:00","date_gmt":"2013-10-16T17:11:00","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=418"},"modified":"2016-02-20T12:57:27","modified_gmt":"2016-02-20T12:57:27","slug":"mongovue-message-invalid-credentials-for-database","status":"publish","type":"post","link":"http:\/\/www.theSQLReport.com\/?p=418","title":{"rendered":"MongoVUE Message &#8211; Invalid credentials for database"},"content":{"rendered":"<p>Being new to the MongoDB database, only in my second week of training,\u00a0 I wanted to test the MongoVUE gui tool to see if it would help make my administration easier.<\/p>\n<p>On a local virtual machine, I have a copy of MongoDB running on Ubuntu.\u00a0 Up until this point, I have been doing everything in the Mongo shell.<\/p>\n<p>After installing an evaluation version of MongoVUE, I attempted to have it connect to the my Mongo database called &#8220;pcat&#8221;.\u00a0 &#8220;Pcat&#8221; is the database that I am using in my training class.\u00a0 I appeared to receive a successful connection to the database using my OS logon &amp; password.\u00a0 However, when I clicked to view the Collections, I received the message: &#8220;Invalid credentials for database &#8216;pcat&#8217;.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/InvalidCredentials.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-419\" alt=\"InvalidCredentials\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/InvalidCredentials.jpg\" width=\"469\" height=\"138\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/InvalidCredentials.jpg 469w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/InvalidCredentials-300x88.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/InvalidCredentials-210x61.jpg 210w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/><\/a><\/p>\n<p>In this case, I had two issues with to resolves before I could connect and administer the &#8216;pcat&#8217; database:<\/p>\n<p>1. Configure the MongoDB software to authenticate for remote connections.<\/p>\n<p>2. Create a user that I can authenticate in the &#8216;pcat&#8217; database.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>The first step is to alter the configuration file that the process &#8216;mongod&#8217; is using.\u00a0 On the server, by running &#8216;ps -ef | grep mongod&#8217;, I was able to see that the process was using the configuration file &#8216;mongodb.conf&#8217; that resided in the &#8216;\/etc&#8217; directory.\u00a0 The configuration file may reside in a different location based on your operating system &amp; configuration at setup.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongod_process.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-421\" alt=\"mongod_process\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongod_process.jpg\" width=\"737\" height=\"49\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongod_process.jpg 737w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongod_process-300x19.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongod_process-210x13.jpg 210w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><\/p>\n<p>Using an editor on that file (like vi), I was able to see that the authentication parameter for remote users was remarked out.\u00a0 I removed the pound sign in front of the &#8220;auth = true&#8221;, and saved the file.\u00a0 Then I restarted the Mongod process by typing &#8220;sudo service mongodb restart&#8221;.\u00a0 Now remote users are able to authenticate to the database.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongo.conf_.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-423\" alt=\"mongo.conf\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongo.conf_.jpg\" width=\"522\" height=\"421\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongo.conf_.jpg 522w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongo.conf_-300x241.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/mongo.conf_-210x169.jpg 210w\" sizes=\"(max-width: 522px) 100vw, 522px\" \/><\/a><\/p>\n<p>Second, we need a user that is permitted to access the database remotely.\u00a0 In the Mongo shell I had to switch to the &#8216;pcat&#8217; database, by typing &#8220;use pcat&#8221;.\u00a0 Then I added a user with the command db.addUser, like db.addUser(&#8221; &lt;username&gt; &#8221; , &#8221; &lt;password&gt; &#8220;).\u00a0 In my example, I used &#8220;buddy&#8221; for both the name &amp; password.\u00a0 I then verified the user with the &#8220;show users&#8221; command.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/AddUser.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-425\" alt=\"AddUser\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/AddUser.jpg\" width=\"430\" height=\"274\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/AddUser.jpg 430w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/AddUser-300x191.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/AddUser-210x133.jpg 210w\" sizes=\"(max-width: 430px) 100vw, 430px\" \/><\/a><\/p>\n<p>After creating the user, I was able to go back to my MongoVUE application, and enter the connection information in the &#8220;MongoVUE Connection&#8221;, with an example pictured below.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/ConnectionInfo.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-427\" alt=\"ConnectionInfo\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/ConnectionInfo.jpg\" width=\"342\" height=\"396\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/ConnectionInfo.jpg 342w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/ConnectionInfo-259x300.jpg 259w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/ConnectionInfo-181x210.jpg 181w\" sizes=\"(max-width: 342px) 100vw, 342px\" \/><\/a><\/p>\n<p>Then I was able to successfully connect to the MongoDB database, and view the Collections.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/PCAT.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-428\" alt=\"PCAT\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/PCAT.jpg\" width=\"199\" height=\"281\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/PCAT.jpg 199w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/10\/PCAT-148x210.jpg 148w\" sizes=\"(max-width: 199px) 100vw, 199px\" \/><\/a><\/p>\n<p>If this does not resolved the error, then check the &#8220;mongodb.log&#8221; on the database server, which is normally located in the &#8220;\/var\/log\/mongodb&#8221; directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Being new to the MongoDB database, only in my second week of training,\u00a0 I wanted to test the MongoVUE gui tool to see if it would help make my administration &hellip; <a class=\"readmore\" href=\"http:\/\/www.theSQLReport.com\/?p=418\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":428,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-418","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/418"}],"collection":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=418"}],"version-history":[{"count":14,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/418\/revisions"}],"predecessor-version":[{"id":439,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/418\/revisions\/439"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/428"}],"wp:attachment":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=418"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}