Home php教程 php手册 phpmyadmin配置文件Servers配置选项说明

phpmyadmin配置文件Servers配置选项说明

Jun 21, 2016 am 08:53 AM
cfg config mysql phpmyadmin

  在介绍完phpmyadmin配置文件部分配置选项后,来说说phpmyadmin配置文件中的Servers选项的使用方法与说明,因为phpmyadmin的安装配置必然涉及phpmyadmin配置文件中Servers选项的配置,否则phpmyadmin无法正常访问。

  phpmyadmin配置文件中的Servers选项是以数组形式出现,这是因为phpmyadmin可以根据需要管理多个Mysql服务器。$cfg['Servers'] 数组用来保存不同Mysql服务器的登录信息。第一个$cfg['Servers'][$i]['host'] 包含第一个服务器的主机名,第二个$cfg['Servers'][$i]['host'] 包含第二个服务器的主机名,以此类推。你可以将libraries目录下的phpmyadmin默认配置文件config.default.php 中的服务器的配置多次复制到根目录下的config.inc.php配置文件中。

  phpmyadmin配置文件Servers配置选项详细说明

  $cfg['Servers'][$i]['host'] :Mysql服务器的主机名或IP地址。如果PHP环境配置和Mysql服务器是一台机器,可以使用localhost或127.0.0.1

  $cfg['Servers'][$i]['port']:Mysql服务器的端口号。默认空值代表3306端口。如果使用localhost作为主机名,Mysql将忽略端口号转而使用套接字连接,所以如果你想连接到非默认端口,需要将$cfg['Servers'][$i]['host'] 设为127.0.0.1或真实的主机名。

  $cfg['Servers'][$i]['socket'] :默认值为空,如果要知道正确的套接字,可以查看Mysql的配置或者在Mysql 客户端命令行中执行status命令。

  $cfg['Servers'][$i]['ssl'] :配置连接到Mysql服务器时是否使用SSL安全连接。

  $cfg['Servers'][$i]['connect_type'] :配置连接到Mysql服务器的类型。可选socket和tcp。默认为tcp

  $cfg['Servers'][$i]['extension']:配置PHP 扩展连接的数据库类型,需要和PHP.INI配置文件中启用的数据库扩展相对应,可以选择Mysql或Mysqli,目前的默认扩展为Mysql。

  $cfg['Servers'][$i]['compress'] :配置是否使用压缩协议连接到Mysql服务器(PHP 4.3.0 及以上版本)。

  $cfg['Servers'][$i]['controluser']与$cfg['Servers'][$i]['controlpass'] :这个账号功能我没用过,下次使用后再介绍介绍。

  $cfg['Servers'][$i]['auth_type']:配置phpmyadmin登陆时的认证方式,总共有四种:config、cookie、http、signon认证。cookie认证,用户名和密码被保存在cookies中,会话结束后将被删除。与之前介绍的$cfg['AllowArbitraryServer']配合使用可以登录到任意服务器。signon认证我也没用过,下次看看scripts/signon.php再来介绍。

  $cfg['Servers'][$i]['auth_http_realm']:此配置选项是和phpmyadmin认证方式http有关,可以自定义http认证时用户收到的提示信息。

  $cfg['Servers'][$i]['auth_swekey_config']:默认为空,主要用于硬件认证。

  $cfg['Servers'][$i]['user']与$cfg['Servers'][$i]['password']:config认证方式时连接Mysql服务器的用户名和密码。密码是在config认证时填写,其他只要留空即可。

  $cfg['Servers'][$i]['SignonSession']:signon认证时的会话。

  $cfg['Servers'][$i]['SignonURL']:signon登陆认证时跳转的URL地址。

  $cfg['Servers'][$i]['LogoutURL']:phpmyadmin退出时跳转的URL地址。

  $cfg['Servers'][$i]['nopassword']:配置当phpmyadmin登录失败时是否允许使用空密码登录。

  $cfg['Servers'][$i]['only_db']:配置在左侧显示的一个或一组数据库名,此配置选项以字符串或数组形式出现,用户只能看到这些数据库。

  $cfg['Servers'][$i]['hide_db'] :配置需要隐藏的数据库。

  上述两个phpmyadmin配置文件中的配置选项定义时可以通过通配符模糊定义,下次再介绍。

  $cfg['Servers'][$i]['verbose'] :配置此主机的详细名称,如果配置为空将显示主机名。当配置使用http认证时,所有非ASCII 字符都将被删除。

  $cfg['Servers'][$i]['pmadb']:主要是用来激活phpmyadmin的链接表的额外特性,具体可参考phpmyadmin安装配置教程。phpmyadmin配置文件中的pmadb功能下次介绍。

  $cfg['Servers'][$i]['verbose_check'] :如果知道你的pma_*表是最新的,可以将其配置为false,从而提高性能。

  $cfg['Servers'][$i]['AllowRoot']:配置是否允许root用户访问。

  $cfg['Servers'][$i]['AllowNoPassword']:配置是否允许使用空密码登录。

  $cfg['Servers'][$i]['AllowDeny']['order']:配置主机认证的顺序,置空则不可用。可配置两种顺序,’deny,allow’,即任何没有被禁止的客户端或者被允许的客户端将被允许访问服务器。’allow,deny’,即任何没有被允许的客户端或者被禁止的客户端将被禁止访问服务器。

  $cfg['Servers'][$i]['AllowDeny']['rules']:与主机认证顺序配置选项像对应,此处是用来定义具体的规则的,下次单独介绍。

  $cfg['Servers'][$i]['DisableIS']:配置是否禁止使用INFORMATION_SCHEMA

  $cfg['Servers'][$i]['ShowDatabasesCommand']:当数据库相当多时,通过默认的SHOW DATABASES 命令来显示具体数据库名可能会很慢,这时可以配置其他命令命令来代替它。在phpmyadmin配置文件config.default.php中有这样的例子,比如用Like)。

  $cfg['Servers'][$i]['CountTables']:配置是否在左侧数据库列表中显示每个数据库中数据表的总数。

  $cfg['Servers'][$i]['tracking_version_auto_create']:配置是否自动创建表和视图的版本。

  $cfg['Servers'][$i]['tracking_default_statements'] :配置自动创建新版的命令列表。

  $cfg['Servers'][$i]['tracking_add_drop_view'] :配置当视图创建时,是否在日志首行加上DROP VIEW IF EXISTS 语句。

  $cfg['Servers'][$i]['tracking_add_drop_table'] :配置当数据表创建时,是否在日志首行加上DROP TABLE IF EXISTS 语句。

  $cfg['Servers'][$i]['tracking_add_drop_database'] :配置当数据库创建时,是否在日志首行加上 DROP DATABASE IF EXISTS 语句。

  上述几个phpmyadmin配置选项其实主要是确认使用phpmyadmin导入导出数据时是否增加相应的DROP语句。

  至此,phpmyadmin配置文件中的Servers选项说明与使用方法就介绍完了,其实如果仔细研究phpmyadmin的配置文件,对使用phpmyadmin会有很大好处,今后还会陆续介绍phpmyadmin配置文件中的其他配置选项。

  :PHP网站开发教程-leapsoul.cn版权所有,转载时请以链接形式注明原始出处及本声明,谢谢。



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

How to adjust the wordpress article list How to adjust the wordpress article list Apr 20, 2025 am 10:48 AM

There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL vs. MySQL: Clarifying the Relationship Between the Two SQL vs. MySQL: Clarifying the Relationship Between the Two Apr 24, 2025 am 12:02 AM

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

See all articles