Cannot connect: invalid settings

phpMyAdmin 'Cannot Connect: Invalid Settings' Fix for MySQL 8

Trying to log in but phpMyAdmin won't connect? This error hits when the config file has wrong server or auth info. Here's how to fix it fast.

When This Error Happens

You type your MySQL username and password into phpMyAdmin, hit Go, and instead of your databases you get a red box: Cannot connect: invalid settings. This tripped me up the first time I moved from MySQL 5.7 to MySQL 8 on a Windows 10 machine running XAMPP 8.2. I spent two hours thinking my password was wrong. It wasn't.

What's Actually Wrong

The error means phpMyAdmin can't reach the MySQL server, or the authentication details in the config file don't match what MySQL expects. The default config.inc.php file points to localhost on port 3306, but MySQL 8 sometimes uses a different socket or has strict auth caching. Also, if you changed the MySQL root password after installation, the config file still has the old one.

Most people don't realize phpMyAdmin has its own config file separate from MySQL. You edit that file, and suddenly things work. Let's fix yours.

Fix It in 5 Steps

Step 1: Find config.inc.php

Locate the file config.inc.php in your phpMyAdmin folder. On XAMPP, it's at C:\xampp\phpMyAdmin\config.inc.php. On Ubuntu with Apache, try /etc/phpmyadmin/config.inc.php. If you don't see one, copy config.sample.inc.php to config.inc.php.

Step 2: Check the Host and Port

Open the file in Notepad or VS Code. Look for this line:

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

If MySQL runs on the same machine, keep localhost. But if you use a different port (like 3307 or 3308), change this line too:

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

On some Linux setups, MySQL listens on a socket file instead of TCP. Change the host to 127.0.0.1 — that forces a TCP connection and often fixes the socket issue.

Step 3: Set the Right Auth Type

Look for this line:

$cfg['Servers'][$i]['auth_type'] = 'cookie';

The default cookie is fine — it shows a login screen. If someone changed it to config, you'll see a blank login or errors. Stick with 'cookie' unless you know exactly what you're doing.

Step 4: Verify the Username and Password (if auth_type is config)

If the file has these lines:

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';

And you changed your MySQL root password, update password. But better yet, use auth_type = 'cookie' and leave the password blank — you'll type it each login. That's safer anyway.

Step 5: Restart Everything

After saving the file, restart Apache and MySQL. On XAMPP, click Stop then Start for both services. On Linux, run:

sudo systemctl restart apache2
sudo systemctl restart mysql

Then reload phpMyAdmin in your browser. Try logging in with the same MySQL credentials you use in the command line.

If It Still Fails

Check these three things:

  • MySQL is actually running. Open a terminal and type mysql -u root -p. If it says "Can't connect" or "Access denied", fix MySQL first — phpMyAdmin won't work until it does.
  • Firewall or antivirus is blocking port 3306. On Windows, check Windows Defender Firewall. On Linux, check UFW or iptables. Temporarily disable the firewall to test, then add an exception.
  • phpMyAdmin version mismatch. If you're running phpMyAdmin 5.x with MySQL 8.0+, you're fine. But if you use an old version (like 4.x) with MySQL 8, upgrade phpMyAdmin. Download the latest from phpmyadmin.net.

That's it. Nine times out of ten, it's the host setting or a wrong port. Change those, and you're back to managing databases.

Related Errors in Database Errors
MISCONF Redis is configured to save RDB snapshots Redis Save Fails: Fix BGSAVE and RDB Errors Fast FATAL: password authentication failed for user Fix PostgreSQL FATAL password authentication failed 0XC000018B Fix STATUS_NO_TRUST_SAM_ACCOUNT (0XC000018B) for SQL Server 0X80110474 Fix COMADMIN_E_REGDB_SYSTEMERR (0X80110474) Fast

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.