Change Port of Mysql Server in Phpmyadmin

62,111

Solution 1

You can change this line:

$cfg['Servers'][$i]['host'] = '127.0.0.1';

with this line:

$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';

Solution 2

From the PhpMyAdmin documentation...

If you use localhost as the hostname, MySQL ignores this port number and connects with the socket, so if you want to connect to a port different from the default port, use 127.0.0.1 or the real hostname in $cfg['Servers'][$i]['host'].

Solution 3

first open Xamppp Control Panel click on Config Button, at the next page click on Services and Port Settings, at that page you can set all ports for all of your services. also you should change content of Phpmyadmin(config.inc.php) file as below

$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['port']= 'your preferred port number';
Share:
62,111
Lokomotywa
Author by

Lokomotywa

Updated on July 23, 2022

Comments

  • Lokomotywa
    Lokomotywa almost 2 years

    I have two instances of MySql (5.1.73-1-log) running on my server, one on port 3306 (default), one on port 3307. Now, I want to change PhpMyAdmin (3.3.7deb7) to take the second instance, on 3307, instead the default one. Thus, I add the following line to config.inc.php:

        $cfg['Servers'][$i]['port'] = '3307';
    

    Now, though PhpMyAdmin says localhost:3307 (look Screenshot), the databases that it accesses are still those from the instance that runs on the default port.

    How do I change the settings in order to make the port change real?

    enter image description here

    • Marc Delisle
      Marc Delisle about 9 years
      Is it possible to stop the instance running on 3306 to see what happens in phpMyAdmin?
    • Matt Clark
      Matt Clark over 8 years
    • Devang Solanki
      Devang Solanki about 7 years
      I have tried your solution for appending port line $cfg['Servers'][$i]['port'] = '3307'; in config.inc.php, It's functioning properly now.
  • Nico Haase
    Nico Haase about 5 years
    Can you explain why one should do that?
  • Floris
    Floris over 2 years
    Because why not