Phpadmin support for logging on to a remote database server

Source: Internet
Author: User
Tags mysql login

Reprint: http://www.cnblogs.com/andydao/p/4227312.html

This data, Baidu can't search, Google1 minutes to fix

first, how to set phpMyAdmin automatic login?

First, locate config.sample.inc.php in the root directory to copy a file name to config.inc.php (if a config.inc.php file already exists, modify the file directly).
Open config.inc.php Find $cfg [' Servers '] [$i] [' Auth_type '], will

Copy Code The code is as follows: $cfg [' Servers '] [$i] [' auth_type '] = ' cookie ';

Change into

Copy Code The code is as follows: $cfg [' Servers '] [$i] [' auth_type '] = ' config ';

Then add the following code below:

Copy Code The code is as follows: $cfg [' Servers '] [$i] [' user '] = ' root '; Set the MySQL user name
$cfg [' Servers '] [$i] [' password '] = ' 123456 '; Set the MySQL password

Second, how to cancel phpMyAdmin automatic login?

Just put

Copy Code The code is as follows: $cfg [' Servers '] [$i] [' auth_type '] = ' config ';


Change into

Copy Code The code is as follows: $cfg [' Servers '] [$i] [' auth_type '] = ' cookie ';

save it.  

> Note:
$cfg [' Servers '] [$i] [' Auth_type '] has three values to be selected, namely, cookies, HTTP, config. The more you use is the cookie and config. When in the formal environment, with the use of cookies, users must enter the correct user name and password, and in the local test server, the general use of Config, save the session after the failure to enter the user name and password, to reduce development time

#####################################

The default installation of phpMyAdmin, usually only a MySQL server, the configuration information is stored in the phpMyAdmin configuration file, when we need to switch between multiple servers to log on, the change is very cumbersome. Following the configuration method, we can conveniently use phpMyAdmin to connect multiple Mysql

Method One: Enter the server IP address, user name, password when landing phpMyAdmin

Disadvantage: Login operation is cumbersome, and switch server must first exit the currently logged on server

procedure: Modify/libraries/config.default.php

under the phpMyAdmin directory

/**
 * Allow login to all user entered server in cookie based authentication
 *
 * @global Boolea n $cfg [' Allowarbitraryserver ']
 */
$cfg [' allowarbitraryserver '] = true;

The default value of False is modified to true;

In order to avoid the loss caused by the modification error, it is strongly recommended to back up the config.default.php file as Config.default.php.bak

Method Two: Login phpMyAdmin only need to enter the user name, password, server address for the drop-down list is optional, after landing can also select other servers to quickly switch. Recommended

Advantages: Easy to login, switch server after login without exiting the current connection.

Operation Steps:

1. Back up the config.sample.inc.php file in the phpMyAdmin root directory is Config.sample.inc.php.bak (this operation avoids the loss caused by the modification error)

2. The config.inc.php file in the backup phpMyAdmin root directory is config.inc.php.bak  (this operation avoids the loss caused by the modification error)

3. Rename the config.sample.inc.php file under the phpMyAdmin root directory to config.inc.php

4. Modify the config.inc.php file to find the first server comments section and modify it to the following

$hosts = Array (
' 1 ' =>array (' host ' = ' localhost ', ' user ' = ' root ', ' password ' = ' 123456′ '),
' 2 ' = Array (' host ' = = ' 192.168.0.1′, ' user ' = ' ciray ', ' password ' = ' 123456′ ')
);

//$hosts Array Subscript starting from 1, the value of host is the server IP address, user is the corresponding MySQL login username, password The value of the MySQL login password, please change to your own

Two servers are configured $hosts array, and if you have more than one server, add the configuration information in the order in which the array is incremented
/*
* First Server
*/
for ($i =1; $i <=count ($hosts); $i + +) {

/* Authentication type */
$cfg [' Servers '] [$i] [' auth_type '] = ' cookie ';
/* Server Parameters */
$cfg [' Servers '] [$i] [' host '] = $hosts [$i] [' Host ']; Modify Host
$cfg [' Servers '] [$i] [' connect_type '] = ' TCP ';
$cfg [' Servers '] [$i] [' compress '] = false;
/* Select mysqli If your server has it */
$cfg [' Servers '] [$i] [' extension '] = ' mysql ';
$cfg [' Servers '] [$i] [' allownopassword '] = true;
$cfg [' Servers '] [$i] [' user '] = $hosts [$i] [' User ']; Modify User Name
$cfg [' Servers '] [$i] [' password '] = $hosts [$i] [' Password ']; Password
/* rajk–for blobstreaming */
$cfg [' Servers '] [$i] [' bs_garbage_threshold '] = 50;
$cfg [' Servers '] [$i] [' bs_repository_threshold '] = ' 32M ';
$cfg [' Servers '] [$i] [' bs_temp_blob_timeout '] = 600;
$cfg [' Servers '] [$i] [' bs_temp_log_threshold '] = ' 32M ';

}
Note that we use a for loop to configure information for all servers, the initial value of the loop variable $i is 1, the configuration information in the $hosts array is traversed, and the contents of the loop body do not need to be changed.

After the modification is completed, save the file, re-login, if you can see the phpMyAdmin login interface appears in the server candidate list, indicating correct

Phpadmin support for logging on to a remote database server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.