Home >Backend Development >PHP Tutorial >How to Resolve \'Connection for controluser as defined in your configuration failed\' in phpMyAdmin with XAMPP?

How to Resolve \'Connection for controluser as defined in your configuration failed\' in phpMyAdmin with XAMPP?

Susan Sarandon
Susan SarandonOriginal
2024-10-19 20:55:021005browse

How to Resolve

Solve the problem of "Control user connection failed" in phpMyAdmin in XAMPP

When using XAMPP, you may encounter: "Connection for controluser as defined in your configuration failed" error. This error is usually caused by configuration issues in the phpMyAdmin installation. Here are the steps on how to resolve this issue:

  1. Log in to phpMyAdmin and create a database and user:

    • Log in to phpMyAdmin using the root user.
    • Create a database named "phpmyadmin".
    • Create a user named "pma" and set "host" to the hostname or IP address of the web server (use localhost if the web server and MySQL are on the same machine). Assign a password to the new user and write it down. Grant the new user full control over the phpmyadmin database.
  2. Import SQL file:

    • Navigate to the sql subdirectory in the phpMyAdmin installation directory.
    • Open the create_tables.sql file.
    • In phpMyAdmin, select the phpmyadmin database and click the "SQL" tab.
    • Copy and paste the text from create_tables.sql into the text box and execute the query.
  3. Modify the phpMyAdmin configuration file:

    • Open the config.inc.php file in the phpMyAdmin installation directory.
    • Add or modify the following lines:
    <code class="php">$cfg['Servers'][1]['pmadb'] = 'phpmyadmin';
    $cfg['Servers'][1]['controluser'] = 'pma';
    $cfg['Servers'][1]['controlpass'] = '<your password>';
    
    $cfg['Servers'][1]['bookmarktable'] = 'pma_bookmark';
    $cfg['Servers'][1]['relation'] = 'pma_relation';
    $cfg['Servers'][1]['userconfig'] = 'pma_userconfig';
    $cfg['Servers'][1]['table_info'] = 'pma_table_info';
    $cfg['Servers'][1]['column_info'] = 'pma_column_info';
    $cfg['Servers'][1]['history'] = 'pma_history';
    $cfg['Servers'][1]['recent'] = 'pma_recent';
    $cfg['Servers'][1]['table_uiprefs'] = 'pma_table_uiprefs';
    $cfg['Servers'][1]['tracking'] = 'pma_tracking';
    $cfg['Servers'][1]['table_coords'] = 'pma_table_coords';
    $cfg['Servers'][1]['pdf_pages'] = 'pma_pdf_pages';
    $cfg['Servers'][1]['designer_coords'] = 'pma_designer_coords';</code>
  4. Log out and log back in to phpMyAdmin:

    • Log out of phpMyAdmin and log in again. This will force phpMyAdmin to reload the configuration.

The problem should be solved.

The above is the detailed content of How to Resolve \'Connection for controluser as defined in your configuration failed\' in phpMyAdmin with XAMPP?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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