{"id":536,"date":"2009-08-07T09:05:45","date_gmt":"2009-08-07T15:05:45","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/archives\/000536"},"modified":"2009-08-07T09:05:45","modified_gmt":"2009-08-07T15:05:45","slug":"using-phpmyadmin-without-the-show-databases-privilege","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/536","title":{"rendered":"Using phpMyAdmin without the &#8220;Show Databases&#8221; privilege"},"content":{"rendered":"<p><a href=\"http:\/\/www.phpmyadmin.net\/\">phpMyAdmin<\/a> is a pretty cool piece of software, and a very useful tool. If you haven&#8217;t used it before, it&#8217;s a full featured web-based interface to <a href=\"http:\/\/www.mysql.com\/\">MySQL<\/a> databases. You can use it to add data, update data, delete data, export data, and basically any other management of the database you might need.<\/p>\n<p>I ran into an issue the other day. I was trying to allow phpMyAdmin to access a database on a remote host. The user that phpMyAdmin was connecting as didn&#8217;t have the &#8220;show databases&#8221; privilege (I imagine this is common in shared hosting environments, which is what this was). This, apparently, is what phpMyAdmin uses to populate the drop-down of databases on the left-hand side after you login. Since it didn&#8217;t display that drop-down, there is no way of selecting the database to which this user did have access.<\/p>\n<p>I searched for a while, but couldn&#8217;t find anyone else with this problem. So I thought I would post the solution I found.<\/p>\n<p>The solution is to hard code authentication data for the remote server in my <code>config.inc.php<\/code> file.\u00a0 Then, you append the server and the database that you want to connect to the phpMyAdmin url.<\/p>\n<p>In the <code>config.inc.php<\/code> file:<br \/>\n<code>$cfg['Servers'][$i]['host'] = 'xxx.xxx.xx.xx';<br \/>\n$cfg['Servers'][$i]['user'] = 'user';<br \/>\n$cfg['Servers'][$i]['password'] = 'pass';<\/code><\/p>\n<p>In the url that normal users use to access the database:<br \/>\n<code>http:\/\/phpMyAdmin.example.com\/phpMyAdmin\/index.php?db=databasename&server=xxx.xxx.xxx.xxx<\/code><\/p>\n<p>The left hand side still isn&#8217;t populated with any databases. But, this allows you to go directly to the database to which you do have access, and perform whatever tasks you want (and have permissions for). I tried adding the &#8220;db&#8221; parameter to the <code>config.inc.php<\/code> file, but that didn&#8217;t seem to work. I didn&#8217;t try using any other form of authentication than hardcoded, as I wanted to make this as simple as possible for the phpMyAdmin users.<\/p>\n<p>I was running an older version of phpMyAdmin (2.11.9.5); I didn&#8217;t test this on newer versions.\u00a0 If you do, please post a comment and let me know if this still works.<\/p>\n<p>[tags]phpmyadmin,mysql privileges,remote database access[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>phpMyAdmin is a pretty cool piece of software, and a very useful tool. If you haven&#8217;t used it before, it&#8217;s a full featured web-based interface to MySQL databases. You can [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,17,33],"tags":[],"class_list":["post-536","post","type-post","status-publish","format-standard","hentry","category-mysql","category-php","category-useful-tools"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":0,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/536\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}