Charas
Charas

Reputation: 1827

I changed MySQL port in XAMPP, now how do I listen to the new port?

I have installed the latest XAMPP with MySQL version 14.14 Distrib 5.6.21, the problem is in my computer, I already have a MySQL database installed by other program that I am using.

So I configure the XAMPP MySQL port to 3307 (default is 3306) inside the my.ini file. However, now my localhost/phpmyadmin seems to read the database installed by the other program, not the one in XAMPP, and also when I test using some PHP files, it shows that I am connected to the database even though XAMPP is turned off (XAMPP MySQL also disconnected).

How do I change the setting of my PHPMyAdmin and localhost to connect to the MySQL port 3307?

I don't understand how all these ports and the database work.

Upvotes: 22

Views: 107019

Answers (7)

Vaibhavi Hule
Vaibhavi Hule

Reputation: 1

To configure PHPMyAdmin to connect to MySQL on port 3307:

  1. Open the config.inc.php file in the PHPMyAdmin directory :

    C:\xampp\phpMyAdmin\config.inc.php

  2. Find the line containing $cfg['Servers'][$i]['host'] and set it to 'localhost:3307':
    $cfg['Servers'][$i]['host'] = 'localhost:3307';

  3. Ensure the port is set correctly in $cfg['Servers'][$i]['port']:
    $cfg['Servers'][$i]['port'] = '3307';

  4. Save the file. After making these changes, PHPMyAdmin should connect to the MySQL database on port 3307.

Upvotes: 0

Faker
Faker

Reputation: 1

    /* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307'; /* change port is here */
$cfg['Servers'][$i]['connect_type'] = 'tcp';

Upvotes: -1

Vijay Kumavat
Vijay Kumavat

Reputation: 741

First open the following path:

  C:\xampp\phpMyAdmin

Add the following string in config.inc.php file.

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

Upvotes: 5

Priyesh Shukla
Priyesh Shukla

Reputation: 16

Add below line under phpMyAdmin/config.inc.php

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

in my case the port number is 8111.

Upvotes: 0

Tariq Ali
Tariq Ali

Reputation: 1

The following worked for me, I just added my port code to:

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

Upvotes: 0

Pradeep Rajput
Pradeep Rajput

Reputation: 725

Goto xampp>phpMyAdmin Directory.

Find the config.inc.php file.

Now change this line:

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

To

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

Upvotes: 46

Isaac Bennetch
Isaac Bennetch

Reputation: 12422

To configure phpMyAdmin to connect to a different port from the default, edit your config.inc.php file and add a line like:

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

(of course substituting any port number as needed). You can also see the official documentation.

Upvotes: 6

Related Questions