setup.html 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Installation &mdash; phpMyAdmin 4.2.7.1 documentation</title>
  7. <link rel="stylesheet" href="_static/default.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '',
  12. VERSION: '4.2.7.1',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/underscore.js"></script>
  20. <script type="text/javascript" src="_static/doctools.js"></script>
  21. <link rel="copyright" title="Copyright" href="copyright.html" />
  22. <link rel="top" title="phpMyAdmin 4.2.7.1 documentation" href="index.html" />
  23. <link rel="next" title="Configuration" href="config.html" />
  24. <link rel="prev" title="Requirements" href="require.html" />
  25. </head>
  26. <body>
  27. <div class="related">
  28. <h3>Navigation</h3>
  29. <ul>
  30. <li class="right" style="margin-right: 10px">
  31. <a href="genindex.html" title="General Index"
  32. accesskey="I">index</a></li>
  33. <li class="right" >
  34. <a href="config.html" title="Configuration"
  35. accesskey="N">next</a> |</li>
  36. <li class="right" >
  37. <a href="require.html" title="Requirements"
  38. accesskey="P">previous</a> |</li>
  39. <li><a href="index.html">phpMyAdmin 4.2.7.1 documentation</a> &raquo;</li>
  40. </ul>
  41. </div>
  42. <div class="document">
  43. <div class="documentwrapper">
  44. <div class="bodywrapper">
  45. <div class="body">
  46. <div class="section" id="installation">
  47. <span id="setup"></span><h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
  48. <p>phpMyAdmin does not apply any special security methods to the MySQL
  49. database server. It is still the system administrator&#8217;s job to grant
  50. permissions on the MySQL databases properly. phpMyAdmin&#8217;s <em class="guilabel">Users</em>
  51. page can be used for this.</p>
  52. <div class="admonition warning">
  53. <p class="first admonition-title">Warning</p>
  54. <p class="last"><a class="reference internal" href="glossary.html#term-mac"><em class="xref std std-term">Mac</em></a> users should note that if you are on a version before
  55. <a class="reference internal" href="glossary.html#term-mac-os-x"><em class="xref std std-term">Mac OS X</em></a>, StuffIt unstuffs with <a class="reference internal" href="glossary.html#term-mac"><em class="xref std std-term">Mac</em></a> formats. So you&#8217;ll have
  56. to resave as in BBEdit to Unix style ALL phpMyAdmin scripts before
  57. uploading them to your server, as PHP seems not to like <a class="reference internal" href="glossary.html#term-mac"><em class="xref std std-term">Mac</em></a>-style
  58. end of lines character (&#8220;<tt class="docutils literal"><span class="pre">\r</span></tt>&#8221;).</p>
  59. </div>
  60. <div class="section" id="linux-distributions">
  61. <h2>Linux distributions<a class="headerlink" href="#linux-distributions" title="Permalink to this headline">¶</a></h2>
  62. <p>phpMyAdmin is included in most Linux distributions. It is recommended to use
  63. distribution packages when possible - they usually provide integration to your
  64. distribution and you will automatically get security updates from your distribution.</p>
  65. <div class="section" id="debian">
  66. <h3>Debian<a class="headerlink" href="#debian" title="Permalink to this headline">¶</a></h3>
  67. <p>Debian&#8217;s package repositories include a phpMyAdmin package, but be aware that
  68. the configuration file is maintained in <tt class="docutils literal"><span class="pre">/etc/phpmyadmin</span></tt> and may differ in
  69. some ways from the official phpMyAdmin documentation.</p>
  70. </div>
  71. <div class="section" id="opensuse">
  72. <h3>OpenSUSE<a class="headerlink" href="#opensuse" title="Permalink to this headline">¶</a></h3>
  73. <p>OpenSUSE already comes with phpMyAdmin package, just install packages from
  74. the <a class="reference external" href="http://software.opensuse.org/package/phpMyAdmin">openSUSE Build Service</a>.</p>
  75. </div>
  76. <div class="section" id="ubuntu">
  77. <h3>Ubuntu<a class="headerlink" href="#ubuntu" title="Permalink to this headline">¶</a></h3>
  78. <p>Ubuntu ships phpMyAdmin package, however if you want to use recent version, you
  79. can use packages from
  80. <a class="reference external" href="https://launchpad.net/~nijel/+archive/phpmyadmin">PPA for Michal Čihař</a>.</p>
  81. </div>
  82. <div class="section" id="gentoo">
  83. <h3>Gentoo<a class="headerlink" href="#gentoo" title="Permalink to this headline">¶</a></h3>
  84. <p>Gentoo ships the phpMyAdmin package, both in a near stock configuration as well
  85. as in a <tt class="docutils literal"><span class="pre">webapp-config</span></tt> configuration. Use <tt class="docutils literal"><span class="pre">emerge</span> <span class="pre">dev-db/phpmyadmin</span></tt> to
  86. install.</p>
  87. </div>
  88. <div class="section" id="mandriva">
  89. <h3>Mandriva<a class="headerlink" href="#mandriva" title="Permalink to this headline">¶</a></h3>
  90. <p>Mandriva ships the phpMyAdmin package in their <tt class="docutils literal"><span class="pre">contrib</span></tt> branch and can be
  91. installed via the usual Control Center.</p>
  92. </div>
  93. <div class="section" id="fedora">
  94. <h3>Fedora<a class="headerlink" href="#fedora" title="Permalink to this headline">¶</a></h3>
  95. <p>Fedora ships the phpMyAdmin package, but be aware that the configuration file
  96. is maintained in <tt class="docutils literal"><span class="pre">/etc/phpMyAdmin/</span></tt> and may differ in some ways from the
  97. official phpMyAdmin documentation.</p>
  98. </div>
  99. <div class="section" id="red-hat-enterprise-linux">
  100. <h3>Red Hat Enterprise Linux<a class="headerlink" href="#red-hat-enterprise-linux" title="Permalink to this headline">¶</a></h3>
  101. <p>Red Hat Enterprise Linux itself and thus derivatives like CentOS don&#8217;t
  102. ship phpMyAdmin, but the Fedora-driven repository
  103. <a class="reference external" href="http://fedoraproject.org/wiki/EPEL">Extra Packages for Enterprise Linux (EPEL)</a>
  104. is doing so, if it&#8217;s
  105. <a class="reference external" href="http://fedoraproject.org/wiki/EPEL/FAQ#howtouse">enabled</a>.
  106. But be aware that the configuration file is maintained in
  107. <tt class="docutils literal"><span class="pre">/etc/phpMyAdmin/</span></tt> and may differ in some ways from the
  108. official phpMyAdmin documentation.</p>
  109. </div>
  110. </div>
  111. <div class="section" id="installing-on-windows">
  112. <h2>Installing on Windows<a class="headerlink" href="#installing-on-windows" title="Permalink to this headline">¶</a></h2>
  113. <p>The easiest way to get phpMyAdmin on Windows is using third party products
  114. which include phpMyAdmin together with a database and web server such as
  115. <a class="reference external" href="http://www.apachefriends.org/en/xampp.html">XAMPP</a>.</p>
  116. <p>You can find more of such options at <a class="reference external" href="https://en.wikipedia.org/wiki/List_of_AMP_packages">Wikipedia</a>.</p>
  117. </div>
  118. <div class="section" id="quick-install">
  119. <span id="id1"></span><h2>Quick Install<a class="headerlink" href="#quick-install" title="Permalink to this headline">¶</a></h2>
  120. <ol class="arabic simple">
  121. <li>Choose an appropriate distribution kit from the phpmyadmin.net
  122. Downloads page. Some kits contain only the English messages, others
  123. contain all languages. We&#8217;ll assume you chose a kit whose name
  124. looks like <tt class="docutils literal"><span class="pre">phpMyAdmin-x.x.x</span> <span class="pre">-all-languages.tar.gz</span></tt>.</li>
  125. <li>Untar or unzip the distribution (be sure to unzip the subdirectories):
  126. <tt class="docutils literal"><span class="pre">tar</span> <span class="pre">-xzvf</span> <span class="pre">phpMyAdmin_x.x.x-all-languages.tar.gz</span></tt> in your
  127. webserver&#8217;s document root. If you don&#8217;t have direct access to your
  128. document root, put the files in a directory on your local machine,
  129. and, after step 4, transfer the directory on your web server using,
  130. for example, ftp.</li>
  131. <li>Ensure that all the scripts have the appropriate owner (if PHP is
  132. running in safe mode, having some scripts with an owner different from
  133. the owner of other scripts will be a problem). See <a class="reference internal" href="faq.html#faq4-2"><em>4.2 What&#8217;s the preferred way of making phpMyAdmin secure against evil access?</em></a> and
  134. <a class="reference internal" href="faq.html#faq1-26"><em>1.26 I just installed phpMyAdmin in my document root of IIS but I get the error &#8220;No input file specified&#8221; when trying to run phpMyAdmin.</em></a> for suggestions.</li>
  135. <li>Now you must configure your installation. There are two methods that
  136. can be used. Traditionally, users have hand-edited a copy of
  137. <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>, but now a wizard-style setup script is provided
  138. for those who prefer a graphical installation. Creating a
  139. <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> is still a quick way to get started and needed for
  140. some advanced features.</li>
  141. </ol>
  142. <div class="section" id="manually-creating-the-file">
  143. <h3>Manually creating the file<a class="headerlink" href="#manually-creating-the-file" title="Permalink to this headline">¶</a></h3>
  144. <p>To manually create the file, simply use your text editor to create the
  145. file <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> (you can copy <tt class="file docutils literal"><span class="pre">config.sample.inc.php</span></tt> to get
  146. a minimal configuration file) in the main (top-level) phpMyAdmin
  147. directory (the one that contains <tt class="file docutils literal"><span class="pre">index.php</span></tt>). phpMyAdmin first
  148. loads <tt class="file docutils literal"><span class="pre">libraries/config.default.php</span></tt> and then overrides those values
  149. with anything found in <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>. If the default value is
  150. okay for a particular setting, there is no need to include it in
  151. <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>. You&#8217;ll probably need only a few directives to get going; a
  152. simple configuration may look like this:</p>
  153. <div class="highlight-xml+php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
  154. <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;blowfish_secret&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;ba17c1ec07d65003&#39;</span><span class="p">;</span> <span class="c1">// use here a value of your choice</span>
  155. <span class="nv">$i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
  156. <span class="nv">$i</span><span class="o">++</span><span class="p">;</span>
  157. <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;auth_type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;cookie&#39;</span><span class="p">;</span>
  158. <span class="cp">?&gt;</span>
  159. </pre></div>
  160. </div>
  161. <p>Or, if you prefer to not be prompted every time you log in:</p>
  162. <div class="highlight-xml+php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
  163. <span class="nv">$i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
  164. <span class="nv">$i</span><span class="o">++</span><span class="p">;</span>
  165. <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;user&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;root&#39;</span><span class="p">;</span>
  166. <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;password&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;cbb74bc&#39;</span><span class="p">;</span> <span class="c1">// use here your password</span>
  167. <span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;auth_type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;config&#39;</span><span class="p">;</span>
  168. <span class="cp">?&gt;</span>
  169. </pre></div>
  170. </div>
  171. <p>For a full explanation of possible configuration values, see the
  172. <a class="reference internal" href="config.html#config"><em>Configuration</em></a> of this document.</p>
  173. </div>
  174. <div class="section" id="using-setup-script">
  175. <span id="setup-script"></span><span id="index-0"></span><h3>Using Setup script<a class="headerlink" href="#using-setup-script" title="Permalink to this headline">¶</a></h3>
  176. <p>Instead of manually editing <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>, you can use the <a class="reference external" href="setup/">Setup
  177. Script</a>. First you must manually create a folder <tt class="docutils literal"><span class="pre">config</span></tt>
  178. in the phpMyAdmin directory. This is a security measure. On a
  179. Linux/Unix system you can use the following commands:</p>
  180. <div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd </span>phpMyAdmin
  181. mkdir config <span class="c"># create directory for saving</span>
  182. chmod o+rw config <span class="c"># give it world writable permissions</span>
  183. </pre></div>
  184. </div>
  185. <p>And to edit an existing configuration, copy it over first:</p>
  186. <div class="highlight-sh"><div class="highlight"><pre>cp config.inc.php config/ <span class="c"># copy current configuration for editing</span>
  187. chmod o+w config/config.inc.php <span class="c"># give it world writable permissions</span>
  188. </pre></div>
  189. </div>
  190. <p>On other platforms, simply create the folder and ensure that your web
  191. server has read and write access to it. <a class="reference internal" href="faq.html#faq1-26"><em>1.26 I just installed phpMyAdmin in my document root of IIS but I get the error &#8220;No input file specified&#8221; when trying to run phpMyAdmin.</em></a> can help with
  192. this.</p>
  193. <p>Next, open <tt class="docutils literal"><span class="pre">setup/</span></tt> in your browser. If you have an existing configuration,
  194. use the <tt class="docutils literal"><span class="pre">Load</span></tt> button to bring its content inside the setup panel.
  195. Note that <strong>changes are not saved to disk until you explicitly choose ``Save``</strong>
  196. from the <em>Configuration</em> area of the screen. Normally the script saves the new
  197. <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> to the <tt class="docutils literal"><span class="pre">config/</span></tt> directory, but if the webserver does
  198. not have the proper permissions you may see the error &#8220;Cannot load or
  199. save configuration.&#8221; Ensure that the <tt class="docutils literal"><span class="pre">config/</span></tt> directory exists and
  200. has the proper permissions - or use the <tt class="docutils literal"><span class="pre">Download</span></tt> link to save the
  201. config file locally and upload it (via FTP or some similar means) to the
  202. proper location.</p>
  203. <p>Once the file has been saved, it must be moved out of the <tt class="docutils literal"><span class="pre">config/</span></tt>
  204. directory and the permissions must be reset, again as a security
  205. measure:</p>
  206. <div class="highlight-sh"><div class="highlight"><pre>mv config/config.inc.php . <span class="c"># move file to current directory</span>
  207. chmod o-rw config.inc.php <span class="c"># remove world read and write permissions</span>
  208. rm -rf config <span class="c"># remove not needed directory</span>
  209. </pre></div>
  210. </div>
  211. <p>Now the file is ready to be used. You can choose to review or edit the
  212. file with your favorite editor, if you prefer to set some advanced
  213. options which the setup script does not provide.</p>
  214. <ol class="arabic simple">
  215. <li>If you are using the <tt class="docutils literal"><span class="pre">auth_type</span></tt> &#8220;config&#8221;, it is suggested that you
  216. protect the phpMyAdmin installation directory because using config
  217. does not require a user to enter a password to access the phpMyAdmin
  218. installation. Use of an alternate authentication method is
  219. recommended, for example with HTTP–AUTH in a <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> file or switch to using
  220. <tt class="docutils literal"><span class="pre">auth_type</span></tt> cookie or http. See the <a class="reference internal" href="faq.html#faqmultiuser"><em>ISPs, multi-user installations</em></a>
  221. for additional information, especially <a class="reference internal" href="faq.html#faq4-4"><em>4.4 phpMyAdmin always gives &#8220;Access denied&#8221; when using HTTP authentication.</em></a>.</li>
  222. <li>Open the <a class="reference external" href="index.php">main phpMyAdmin directory</a> in your browser.
  223. phpMyAdmin should now display a welcome screen and your databases, or
  224. a login dialog if using <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> or
  225. cookie authentication mode.</li>
  226. <li>You should deny access to the <tt class="docutils literal"><span class="pre">./libraries</span></tt> and <tt class="docutils literal"><span class="pre">./setup/lib</span></tt>
  227. subfolders in your webserver configuration. For Apache you can use
  228. supplied <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> file in that folder, for other webservers, you should
  229. configure this yourself. Such configuration prevents from possible
  230. path exposure and cross side scripting vulnerabilities that might
  231. happen to be found in that code.</li>
  232. <li>It is generally a good idea to protect a public phpMyAdmin installation
  233. against access by robots as they usually can not do anything good
  234. there. You can do this using <tt class="docutils literal"><span class="pre">robots.txt</span></tt> file in root of your
  235. webserver or limit access by web server configuration, see
  236. <a class="reference internal" href="faq.html#faq1-42"><em>1.42 How can I prevent robots from accessing phpMyAdmin?</em></a>.</li>
  237. </ol>
  238. </div>
  239. </div>
  240. <div class="section" id="phpmyadmin-configuration-storage">
  241. <span id="linked-tables"></span><span id="index-1"></span><h2>phpMyAdmin configuration storage<a class="headerlink" href="#phpmyadmin-configuration-storage" title="Permalink to this headline">¶</a></h2>
  242. <p>For a whole set of additional features (bookmarks, comments, <a class="reference internal" href="glossary.html#term-sql"><em class="xref std std-term">SQL</em></a>-history,
  243. tracking mechanism, <a class="reference internal" href="glossary.html#term-pdf"><em class="xref std std-term">PDF</em></a>-generation, column contents transformation,
  244. etc.) you need to create a set of special tables. Those tables can be located
  245. in your own database, or in a central database for a multi-user installation
  246. (this database would then be accessed by the controluser, so no other user
  247. should have rights to it).</p>
  248. <p>Please look at your <tt class="docutils literal"><span class="pre">./examples/</span></tt> directory, where you should find a
  249. file called <em>create_tables.sql</em>. (If you are using a Windows server,
  250. pay special attention to <a class="reference internal" href="faq.html#faq1-23"><em>1.23 I&#8217;m running MySQL on a Win32 machine. Each time I create a new table the table and column names are changed to lowercase!</em></a>).</p>
  251. <p>If you already had this infrastructure and upgraded to MySQL 4.1.2 or
  252. newer, please use <tt class="file docutils literal"><span class="pre">examples/upgrade_tables_mysql_4_1_2+.sql</span></tt>
  253. and then create new tables by importing
  254. <tt class="file docutils literal"><span class="pre">examples/create_tables.sql</span></tt>.</p>
  255. <p>You can use your phpMyAdmin to create the tables for you. Please be
  256. aware that you may need special (administrator) privileges to create
  257. the database and tables, and that the script may need some tuning,
  258. depending on the database name.</p>
  259. <p>After having imported the <tt class="file docutils literal"><span class="pre">examples/create_tables.sql</span></tt> file, you
  260. should specify the table names in your <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> file. The
  261. directives used for that can be found in the <a class="reference internal" href="config.html#config"><em>Configuration</em></a>.</p>
  262. <p>You will also need to have a controluser
  263. (<span class="target" id="index-2"></span><a class="reference internal" href="config.html#cfg_Servers_controluser"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['controluser']</span></tt></a> and
  264. <span class="target" id="index-3"></span><a class="reference internal" href="config.html#cfg_Servers_controlpass"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['controlpass']</span></tt></a> settings)
  265. with the proper rights to those tables. For example you can create it
  266. using following statement:</p>
  267. <div class="highlight-mysql"><div class="highlight"><pre><span class="k">GRANT</span> <span class="k">SELECT</span><span class="p">,</span> <span class="k">INSERT</span><span class="p">,</span> <span class="k">UPDATE</span><span class="p">,</span> <span class="k">DELETE</span> <span class="k">ON</span> <span class="o">&lt;</span><span class="n">pma_db</span><span class="o">&gt;</span><span class="p">.</span><span class="o">*</span> <span class="k">TO</span> <span class="s1">&#39;pma&#39;</span><span class="o">@</span><span class="s1">&#39;localhost&#39;</span> <span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;pmapass&#39;</span><span class="p">;</span>
  268. </pre></div>
  269. </div>
  270. </div>
  271. <div class="section" id="upgrading-from-an-older-version">
  272. <span id="upgrading"></span><h2>Upgrading from an older version<a class="headerlink" href="#upgrading-from-an-older-version" title="Permalink to this headline">¶</a></h2>
  273. <p>Simply copy <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> from your previous installation into
  274. the newly unpacked one. Configuration files from old versions may
  275. require some tweaking as some options have been changed or removed.
  276. For compatibility with PHP 6, remove a
  277. <tt class="docutils literal"><span class="pre">set_magic_quotes_runtime(0);</span></tt> statement that you might find near
  278. the end of your configuration file.</p>
  279. <p>You should <strong>not</strong> copy <tt class="file docutils literal"><span class="pre">libraries/config.default.php</span></tt> over
  280. <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt> because the default configuration file is version-
  281. specific.</p>
  282. <p>If you have upgraded your MySQL server from a version previous to 4.1.2 to
  283. version 5.x or newer and if you use the phpMyAdmin configuration storage, you
  284. should run the <a class="reference internal" href="glossary.html#term-sql"><em class="xref std std-term">SQL</em></a> script found in
  285. <tt class="file docutils literal"><span class="pre">examples/upgrade_tables_mysql_4_1_2+.sql</span></tt>.</p>
  286. </div>
  287. <div class="section" id="using-authentication-modes">
  288. <span id="authentication-modes"></span><span id="index-4"></span><h2>Using authentication modes<a class="headerlink" href="#using-authentication-modes" title="Permalink to this headline">¶</a></h2>
  289. <p><a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> and cookie authentication modes are recommended in a <strong>multi-user
  290. environment</strong> where you want to give users access to their own database and
  291. don&#8217;t want them to play around with others. Nevertheless be aware that MS
  292. Internet Explorer seems to be really buggy about cookies, at least till version
  293. 6. Even in a <strong>single-user environment</strong>, you might prefer to use <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a>
  294. or cookie mode so that your user/password pair are not in clear in the
  295. configuration file.</p>
  296. <p><a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> and cookie authentication
  297. modes are more secure: the MySQL login information does not need to be
  298. set in the phpMyAdmin configuration file (except possibly for the
  299. <span class="target" id="index-5"></span><a class="reference internal" href="config.html#cfg_Servers_controluser"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['controluser']</span></tt></a>).
  300. However, keep in mind that the password travels in plain text, unless
  301. you are using the HTTPS protocol. In cookie mode, the password is
  302. stored, encrypted with the blowfish algorithm, in a temporary cookie.</p>
  303. <p>Then each of the <em>true</em> users should be granted a set of privileges
  304. on a set of particular databases. Normally you shouldn&#8217;t give global
  305. privileges to an ordinary user, unless you understand the impact of those
  306. privileges (for example, you are creating a superuser).
  307. For example, to grant the user <em>real_user</em> with all privileges on
  308. the database <em>user_base</em>:</p>
  309. <div class="highlight-mysql"><div class="highlight"><pre><span class="k">GRANT</span> <span class="k">ALL</span> <span class="n">PRIVILEGES</span> <span class="k">ON</span> <span class="n">user_base</span><span class="p">.</span><span class="o">*</span> <span class="k">TO</span> <span class="s1">&#39;real_user&#39;</span><span class="o">@</span><span class="n">localhost</span> <span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;real_password&#39;</span><span class="p">;</span>
  310. </pre></div>
  311. </div>
  312. <p>What the user may now do is controlled entirely by the MySQL user management
  313. system. With HTTP or cookie authentication mode, you don&#8217;t need to fill the
  314. user/password fields inside the <span class="target" id="index-6"></span><a class="reference internal" href="config.html#cfg_Servers"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers']</span></tt></a>.</p>
  315. <div class="section" id="http-authentication-mode">
  316. <span id="index-7"></span><h3>HTTP authentication mode<a class="headerlink" href="#http-authentication-mode" title="Permalink to this headline">¶</a></h3>
  317. <ul class="simple">
  318. <li>Uses <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> Basic authentication
  319. method and allows you to log in as any valid MySQL user.</li>
  320. <li>Is supported with most PHP configurations. For <a class="reference internal" href="glossary.html#term-iis"><em class="xref std std-term">IIS</em></a> (<a class="reference internal" href="glossary.html#term-isapi"><em class="xref std std-term">ISAPI</em></a>)
  321. support using <a class="reference internal" href="glossary.html#term-cgi"><em class="xref std std-term">CGI</em></a> PHP see <a class="reference internal" href="faq.html#faq1-32"><em>1.32 Can I use HTTP authentication with IIS?</em></a>, for using with Apache
  322. <a class="reference internal" href="glossary.html#term-cgi"><em class="xref std std-term">CGI</em></a> see <a class="reference internal" href="faq.html#faq1-35"><em>1.35 Can I use HTTP authentication with Apache CGI?</em></a>.</li>
  323. <li>See also <a class="reference internal" href="faq.html#faq4-4"><em>4.4 phpMyAdmin always gives &#8220;Access denied&#8221; when using HTTP authentication.</em></a> about not using the <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> mechanism along with
  324. &#8216;<a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a>&#8216; authentication mode.</li>
  325. </ul>
  326. </div>
  327. <div class="section" id="cookie-authentication-mode">
  328. <span id="cookie"></span><span id="index-8"></span><h3>Cookie authentication mode<a class="headerlink" href="#cookie-authentication-mode" title="Permalink to this headline">¶</a></h3>
  329. <ul class="simple">
  330. <li>You can use this method as a replacement for the <a class="reference internal" href="glossary.html#term-http"><em class="xref std std-term">HTTP</em></a> authentication
  331. (for example, if you&#8217;re running <a class="reference internal" href="glossary.html#term-iis"><em class="xref std std-term">IIS</em></a>).</li>
  332. <li>Obviously, the user must enable cookies in the browser, but this is
  333. now a requirement for all authentication modes.</li>
  334. <li>With this mode, the user can truly log out of phpMyAdmin and log
  335. back in with the same username.</li>
  336. <li>If you want to allow users to enter any hostname to connect (rather than only
  337. servers that are configured in <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>),
  338. see the <span class="target" id="index-9"></span><a class="reference internal" href="config.html#cfg_AllowArbitraryServer"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['AllowArbitraryServer']</span></tt></a> directive.</li>
  339. <li>As mentioned in the <a class="reference internal" href="require.html#require"><em>Requirements</em></a> section, having the <tt class="docutils literal"><span class="pre">mcrypt</span></tt> extension will
  340. speed up access considerably, but is not required.</li>
  341. </ul>
  342. </div>
  343. <div class="section" id="signon-authentication-mode">
  344. <span id="index-10"></span><h3>Signon authentication mode<a class="headerlink" href="#signon-authentication-mode" title="Permalink to this headline">¶</a></h3>
  345. <ul class="simple">
  346. <li>This mode is a convenient way of using credentials from another
  347. application to authenticate to phpMyAdmin.</li>
  348. <li>The other application has to store login information into session
  349. data.</li>
  350. </ul>
  351. <div class="admonition-see-also admonition seealso">
  352. <p class="first admonition-title">See also</p>
  353. <p class="last"><span class="target" id="index-11"></span><a class="reference internal" href="config.html#cfg_Servers_auth_type"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['auth_type']</span></tt></a>,
  354. <span class="target" id="index-12"></span><a class="reference internal" href="config.html#cfg_Servers_SignonSession"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonSession']</span></tt></a>,
  355. <span class="target" id="index-13"></span><a class="reference internal" href="config.html#cfg_Servers_SignonScript"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonScript']</span></tt></a>,
  356. <span class="target" id="index-14"></span><a class="reference internal" href="config.html#cfg_Servers_SignonURL"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['SignonURL']</span></tt></a></p>
  357. </div>
  358. </div>
  359. <div class="section" id="config-authentication-mode">
  360. <span id="index-15"></span><h3>Config authentication mode<a class="headerlink" href="#config-authentication-mode" title="Permalink to this headline">¶</a></h3>
  361. <ul class="simple">
  362. <li>This mode is sometimes the less secure one because it requires you to fill the
  363. <span class="target" id="index-16"></span><a class="reference internal" href="config.html#cfg_Servers_user"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['user']</span></tt></a> and
  364. <span class="target" id="index-17"></span><a class="reference internal" href="config.html#cfg_Servers_password"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['password']</span></tt></a>
  365. fields (and as a result, anyone who can read your <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>
  366. can discover your username and password).</li>
  367. <li>In the <a class="reference internal" href="faq.html#faqmultiuser"><em>ISPs, multi-user installations</em></a> section, there is an entry explaining how
  368. to protect your configuration file.</li>
  369. <li>For additional security in this mode, you may wish to consider the
  370. Host authentication <span class="target" id="index-18"></span><a class="reference internal" href="config.html#cfg_Servers_AllowDeny_order"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['AllowDeny']['order']</span></tt></a>
  371. and <span class="target" id="index-19"></span><a class="reference internal" href="config.html#cfg_Servers_AllowDeny_rules"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['AllowDeny']['rules']</span></tt></a> configuration directives.</li>
  372. <li>Unlike cookie and http, does not require a user to log in when first
  373. loading the phpMyAdmin site. This is by design but could allow any
  374. user to access your installation. Use of some restriction method is
  375. suggested, perhaps a <a class="reference internal" href="glossary.html#term-htaccess"><em class="xref std std-term">.htaccess</em></a> file with the HTTP-AUTH directive or disallowing
  376. incoming HTTP requests at one’s router or firewall will suffice (both
  377. of which are beyond the scope of this manual but easily searchable
  378. with Google).</li>
  379. </ul>
  380. </div>
  381. <div class="section" id="swekey-authentication-mode">
  382. <span id="swekey"></span><span id="index-20"></span><h3>Swekey authentication mode<a class="headerlink" href="#swekey-authentication-mode" title="Permalink to this headline">¶</a></h3>
  383. <p>The Swekey is a low cost authentication USB key that can be used in
  384. web applications. When Swekey authentication is activated, phpMyAdmin
  385. requires the users&#8217;s Swekey to be plugged before entering the login
  386. page (currently supported for cookie authentication mode only). Swekey
  387. Authentication is disabled by default. To enable it, add the following
  388. line to <tt class="file docutils literal"><span class="pre">config.inc.php</span></tt>:</p>
  389. <div class="highlight-php"><div class="highlight"><pre><span class="nv">$cfg</span><span class="p">[</span><span class="s1">&#39;Servers&#39;</span><span class="p">][</span><span class="nv">$i</span><span class="p">][</span><span class="s1">&#39;auth_swekey_config&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;/etc/swekey.conf&#39;</span><span class="p">;</span>
  390. </pre></div>
  391. </div>
  392. <p>You then have to create the <tt class="docutils literal"><span class="pre">swekey.conf</span></tt> file that will associate
  393. each user with their Swekey Id. It is important to place this file
  394. outside of your web server&#8217;s document root (in the example, it is
  395. located in <tt class="docutils literal"><span class="pre">/etc</span></tt>). A self documented sample file is provided in the
  396. <tt class="docutils literal"><span class="pre">examples</span></tt> directory. Feel free to use it with your own users&#8217;
  397. information. If you want to purchase a Swekey please visit
  398. <a class="reference external" href="http://phpmyadmin.net/auth_key">http://phpmyadmin.net/auth_key</a>
  399. since this link provides funding for phpMyAdmin.</p>
  400. <div class="admonition-see-also admonition seealso">
  401. <p class="first admonition-title">See also</p>
  402. <p class="last"><span class="target" id="index-21"></span><a class="reference internal" href="config.html#cfg_Servers_auth_swekey_config"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['auth_swekey_config']</span></tt></a></p>
  403. </div>
  404. </div>
  405. </div>
  406. <div class="section" id="securing-your-phpmyadmin-installation">
  407. <h2>Securing your phpMyAdmin installation<a class="headerlink" href="#securing-your-phpmyadmin-installation" title="Permalink to this headline">¶</a></h2>
  408. <p>The phpMyAdmin team tries hard to make the application secure, however there
  409. are always ways to make your installation more secure:</p>
  410. <ul class="simple">
  411. <li>remove <tt class="docutils literal"><span class="pre">setup</span></tt> directory from phpMyAdmin, you will probably not
  412. use it after initial setup</li>
  413. <li>properly choose authentication method - <a class="reference internal" href="#cookie"><em>Cookie authentication mode</em></a>
  414. is probably the best choice for shared hosting</li>
  415. <li>in case you don&#8217;t want all MySQL users to be able to access
  416. phpMyAdmin, you can use <span class="target" id="index-22"></span><a class="reference internal" href="config.html#cfg_Servers_AllowDeny_rules"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['Servers'][$i]['AllowDeny']['rules']</span></tt></a> to limit them</li>
  417. <li>consider hiding phpMyAdmin behind authentication proxy, so that
  418. MySQL credentials are not all users need to login</li>
  419. <li>if you are afraid of automated attacks, enabling Captcha by
  420. <span class="target" id="index-23"></span><a class="reference internal" href="config.html#cfg_CaptchaLoginPublicKey"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['CaptchaLoginPublicKey']</span></tt></a> and
  421. <span class="target" id="index-24"></span><a class="reference internal" href="config.html#cfg_CaptchaLoginPrivateKey"><tt class="xref config config-option docutils literal"><span class="pre">$cfg['CaptchaLoginPrivateKey']</span></tt></a> might be an option.</li>
  422. </ul>
  423. </div>
  424. </div>
  425. </div>
  426. </div>
  427. </div>
  428. <div class="sphinxsidebar">
  429. <div class="sphinxsidebarwrapper">
  430. <h3><a href="index.html">Table Of Contents</a></h3>
  431. <ul>
  432. <li><a class="reference internal" href="#">Installation</a><ul>
  433. <li><a class="reference internal" href="#linux-distributions">Linux distributions</a><ul>
  434. <li><a class="reference internal" href="#debian">Debian</a></li>
  435. <li><a class="reference internal" href="#opensuse">OpenSUSE</a></li>
  436. <li><a class="reference internal" href="#ubuntu">Ubuntu</a></li>
  437. <li><a class="reference internal" href="#gentoo">Gentoo</a></li>
  438. <li><a class="reference internal" href="#mandriva">Mandriva</a></li>
  439. <li><a class="reference internal" href="#fedora">Fedora</a></li>
  440. <li><a class="reference internal" href="#red-hat-enterprise-linux">Red Hat Enterprise Linux</a></li>
  441. </ul>
  442. </li>
  443. <li><a class="reference internal" href="#installing-on-windows">Installing on Windows</a></li>
  444. <li><a class="reference internal" href="#quick-install">Quick Install</a><ul>
  445. <li><a class="reference internal" href="#manually-creating-the-file">Manually creating the file</a></li>
  446. <li><a class="reference internal" href="#using-setup-script">Using Setup script</a></li>
  447. </ul>
  448. </li>
  449. <li><a class="reference internal" href="#phpmyadmin-configuration-storage">phpMyAdmin configuration storage</a></li>
  450. <li><a class="reference internal" href="#upgrading-from-an-older-version">Upgrading from an older version</a></li>
  451. <li><a class="reference internal" href="#using-authentication-modes">Using authentication modes</a><ul>
  452. <li><a class="reference internal" href="#http-authentication-mode">HTTP authentication mode</a></li>
  453. <li><a class="reference internal" href="#cookie-authentication-mode">Cookie authentication mode</a></li>
  454. <li><a class="reference internal" href="#signon-authentication-mode">Signon authentication mode</a></li>
  455. <li><a class="reference internal" href="#config-authentication-mode">Config authentication mode</a></li>
  456. <li><a class="reference internal" href="#swekey-authentication-mode">Swekey authentication mode</a></li>
  457. </ul>
  458. </li>
  459. <li><a class="reference internal" href="#securing-your-phpmyadmin-installation">Securing your phpMyAdmin installation</a></li>
  460. </ul>
  461. </li>
  462. </ul>
  463. <h4>Previous topic</h4>
  464. <p class="topless"><a href="require.html"
  465. title="previous chapter">Requirements</a></p>
  466. <h4>Next topic</h4>
  467. <p class="topless"><a href="config.html"
  468. title="next chapter">Configuration</a></p>
  469. <h3>This Page</h3>
  470. <ul class="this-page-menu">
  471. <li><a href="_sources/setup.txt"
  472. rel="nofollow">Show Source</a></li>
  473. </ul>
  474. <div id="searchbox" style="display: none">
  475. <h3>Quick search</h3>
  476. <form class="search" action="search.html" method="get">
  477. <input type="text" name="q" />
  478. <input type="submit" value="Go" />
  479. <input type="hidden" name="check_keywords" value="yes" />
  480. <input type="hidden" name="area" value="default" />
  481. </form>
  482. <p class="searchtip" style="font-size: 90%">
  483. Enter search terms or a module, class or function name.
  484. </p>
  485. </div>
  486. <script type="text/javascript">$('#searchbox').show(0);</script>
  487. </div>
  488. </div>
  489. <div class="clearer"></div>
  490. </div>
  491. <div class="related">
  492. <h3>Navigation</h3>
  493. <ul>
  494. <li class="right" style="margin-right: 10px">
  495. <a href="genindex.html" title="General Index"
  496. >index</a></li>
  497. <li class="right" >
  498. <a href="config.html" title="Configuration"
  499. >next</a> |</li>
  500. <li class="right" >
  501. <a href="require.html" title="Requirements"
  502. >previous</a> |</li>
  503. <li><a href="index.html">phpMyAdmin 4.2.7.1 documentation</a> &raquo;</li>
  504. </ul>
  505. </div>
  506. <div class="footer">
  507. &copy; <a href="copyright.html">Copyright</a> 2012 - 2014, The phpMyAdmin devel team.
  508. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
  509. </div>
  510. </body>
  511. </html>