怎样安装 phpMyAdmin

2014年12月17日 | 分类: 【技术】

【版本】

版本 5.0之后:

要求 PHP7.1.3+ 。否则报错“PHP 7.1.3+ is required.”

wget https://files.phpmyadmin.net/phpMyAdmin/5.0.0-alpha1/phpMyAdmin-5.0.0-alpha1-all-languages.zip && unzip phpMyAdmin-5.0.0-alpha1-all-languages.zip && rm phpMyAdmin-5.0.0-alpha1-all-languages.zip

版本 4.9.0之前:

支持 php5.6 和 PHP7 。

wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.zip && unzip phpMyAdmin-4.9.0.1-all-languages.zip && rm phpMyAdmin-4.9.0.1-all-languages.zip

版本 4.0.10之前:

支持 PHP 5.2.17 及之前版本。

wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.19/phpMyAdmin-4.0.10.19-all-languages.zip && unzip phpMyAdmin-4.0.10.19-all-languages.zip && mv phpMyAdmin-4.0.10.19-all-languages phpmyadmin

phpMyAdmin的高版本是不支持PHP 5.3以下的系统。如果需要使用PHP 5.2.17版本,只能使用低版本的phpMyAdmin 4.0.10系列。

Older version compatible with PHP 5.2 and MySQL 5. Supported for security fixes only, until April 1, 2017.

【配置】

参考:https://docs.phpmyadmin.net/zh_CN/latest/config.html

修改libraries/config.default.php的如下几个配置。

//这个cookie的加密,密钥,防止模拟cookie破解,最好不要留空
$cfg['blowfish_secret'] = 'hsf%wJf%wJ6tHHtHn@p%wJ6HtHnMF3T';

//MySQL服务器地址
$cfg['Servers'][$i]['host'] = '127.0.0.1';

//默认是config,不要密码就能进入,换成cookie要输入用户和密码的
$cfg['Servers'][$i]['auth_type'] = 'cookie';

//是否允许root账户登录
$cfg['Servers'][$i]['AllowRoot'] = true;

1. 通过 examples/create_tables.sql 创建必需的数据表。
2. 创建一个用户并授予其访问上一步操作中创建的数据表的权限。
3. 在配置文件 (config.inc.php) 中启用高级功能,参见 config.sample.inc.php 中的范例。
4. 请重新登录 phpMyAdmin 以加载新配置并使其生效。

修改libraries/config.default.php的如下几个配置。

//这个cookie的加密,密钥,防止模拟cookie破解,最好不要留空
$cfg['blowfish_secret'] = 'a8b7c6d';

//默认是config,不要密码就能进入,换成cookie要输入用户和密码的
$cfg['Servers'][$i]['auth_type'] = 'cookie';

// PHP 5 support for new MySQL 4.1.3+ features:
$cfg['Servers'][$i]['extension'] = 'mysqli';

//是否允许root账户登录
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;

用浏览器访问phpmyadmin网址,在登录页面输入mysql的用户和密码就能登录后台了。

报错:The phpMyAdmin configuration storage has been deactivated

create new tables by importing examples/create_tables.sql.

You can use your phpMyAdmin to create the tables for you. Please be aware that you may need special (administrator) privileges to create the database and tables, and that the script may need some tuning, depending on the database name.

After having imported the examples/create_tables.sql file, you should specify the table names in your config.inc.php file. The directives used for that can be found in the Configuration.

You will also need to have a controluser ($cfg[‘Servers’][$i][‘controluser’] and $cfg[‘Servers’][$i][‘controlpass’] settings) with the proper rights to those tables. For example you can create it using following statement:

GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'  IDENTIFIED BY 'pmapass';

报错:变量 $cfg[‘TempDir’] (./tmp/)无法访问。phpMyAdmin无法缓存模板文件,所以会运行缓慢。

在 phpMyAdmin 安装目录下创建 tmp 文件夹,设置权限为 777 。