快速安装

  1. 从 phpmyadmin.net 下载页选择一个合适的版本。有些版本只有英语,有些包含了所有语言。假设您选择了一个名字类似于 phpMyAdmin-x.x.x -all-languages.tar.gz 的版本。
  2. Ensure you have downloaded a genuine archive, see Verifying phpMyAdmin releases.
  3. Untar or unzip the distribution (be sure to unzip the subdirectories): tar -xzvf phpMyAdmin_x.x.x-all-languages.tar.gz in your webserver’s document root. If you don’t have direct access to your document root, put the files in a directory on your local machine, and, after step 4, transfer the directory on your web server using, for example, FTP.
  4. 确保所有的脚本都有正确的所有者(若 PHP 运行于安全模式,脚本间所有者的不同将会导致问题)。参见 4.2 What’s the preferred way of making phpMyAdmin secure against evil access?1.26 I just installed phpMyAdmin in my document root of IIS but I get the error “No input file specified” when trying to run phpMyAdmin.
  5. 现在开始设置您的安装。两种方法。以前,用户只能手动编辑一份 config.inc.php 文件,但现在我们为那些喜欢使用图形界面安装的用户提供了一个向导式的安装脚本。手动创建 config.inc.php 仍然是一个快速安装的方法且一些高级功能也需要手动编辑该文件。

Manually creating the file

To manually create the file, simply use your text editor to create the file config.inc.php (you can copy config.sample.inc.php to get a minimal configuration file) in the main (top-level) phpMyAdmin directory (the one that contains index.php). phpMyAdmin first loads libraries/config.default.php and then overrides those values with anything found in config.inc.php. If the default value is okay for a particular setting, there is no need to include it in config.inc.php. You’ll probably need only a few directives to get going; a simple configuration may look like this:

  1. <?php
  2. // use here a value of your choice at least 32 chars long
  3. $cfg['blowfish_secret'] = '1{dd0`<Q),5XP_:R9UK%%8\"EEcyH#{o';
  4. $i=0;
  5. $i++;
  6. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  7. // if you insist on "root" having no password:
  8. // $cfg['Servers'][$i]['AllowNoPassword'] = true;

或者,若您不想每次都登录:

  1. <?php
  2. $i=0;
  3. $i++;
  4. $cfg['Servers'][$i]['user'] = 'root';
  5. $cfg['Servers'][$i]['password'] = 'changeme'; // use here your password
  6. $cfg['Servers'][$i]['auth_type'] = 'config';

警告

Storing passwords in the configuration is insecure as anybody can then manipulate your database.

所有设置的完整说明请参见本文档的 设置 一节。

Using the Setup script

Instead of manually editing config.inc.php, you can use phpMyAdmin’s setup feature. The file can be generated using the setup and you can download it for upload to the server.

Next, open your browser and visit the location where you installed phpMyAdmin, with the /setup suffix. The changes are not saved to the server, you need to use the Download button to save them to your computer and then upload to the server.

Now the file is ready to be used. You can choose to review or edit the file with your favorite editor, if you prefer to set some advanced options that the setup script does not provide.

  1. 若您使用“config”认证方式,您应保护好 phpMyAdmin 的安装文件夹,因为 config 认证不要求用户输入密码即可访问 phpMyAdmin。我们建议使用其它认证方式,如在 .htaccess 文件中设置 HTTP 认证或修改``认证方式``为 cookie 或 http。参见 ISPs, multi-user installations,特别要注意 4.4 phpMyAdmin always gives “Access denied” when using HTTP authentication.
  2. Open the main phpMyAdmin directory in your browser. phpMyAdmin should now display a welcome screen and your databases, or a login dialog if using HTTP or cookie authentication mode.

Setup script on Debian, Ubuntu and derivatives

Debian and Ubuntu have changed the way in which the setup script is enabled and disabled, in a way that single command has to be executed for either of these.

To allow editing configuration invoke:

  1. /usr/sbin/pma-configure

To block editing configuration invoke:

  1. /usr/sbin/pma-secure

Setup script on openSUSE

Some openSUSE releases do not include setup script in the package. In case you want to generate configuration on these you can either download original package from [https://www.phpmyadmin.net/](https://www.phpmyadmin.net/)\ or use setup script on our demo server: [https://demo.phpmyadmin.net/master/setup/](https://demo.phpmyadmin.net/master/setup/)\.