'XAMPP MySQL said: Cannot connect: invalid settings
MySQL was working fine and then for no reason I start getting this error whenever I open http://localhost/phpmyadmin/
I spent hours here trying to find solutions but all what I've tried did not work.
can someone please help me?
I am using: XAMPP Version: 7.3.6
Thanks
config.inc.php file content
<?php
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* 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';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
/*
* End of servers configuration
*/
?>
Solution 1:[1]
SOLUTION - TRIED AND TESTED.
open folder >> C:\xampp\mysql\bin open file (edit) >> my.ini
Add this line
# The MySQL server
default-character-set=utf8mb4
[mysqld]
skip-grant-tables <<<--- Add this line
port=3306
Save file.
Restart XAMPP. Go to http://localhost/phpmyadmin/
And there you have it.
Solution 2:[2]
Solution 3:[3]
$cfg['Servers'][$i]['AllowNoPassword'] = true; <--- change this
$cfg['Servers'][$i]['AllowNoPassword'] = false; <--- to this fixed the problem.
Note: there are other areas in localhost where you have to change the password manually. For example in "CD Collection" example. The password is hard coded there rather than picking it up from config.inc.php.
Solution 4:[4]
I do not know why but for some reasons when I start XAMPP control panel as Administrator I can connect to phpMyAdmin with no issues
Solution 5:[5]
The error messages are a bit confusing as it mentions MariaDb server. There was a change to WAMP server recently to allow MariaDb, don't know if XAMPP did the same. WAMP server switch MySQL to MariaDB
Given that it works when you run as Administrator, I'd say it cannot access a settings file when run as normal. Can you check the permissions on config.inc.php?
When it does connect as administrator: do you have to enter your mySql username and password? what do you see in the database panel? Server: Local Databases (127.0.0.1 via TCP/IP) Server type: MySQL Server version: 5.7.14 - MySQL Community Server (GPL) Protocol version: 10 User: root@localhost Server charset: UTF-8 Unicode (utf8), example:
Solution 6:[6]
Possibly a security precaution. You could try adding a new administrator account:
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
-> WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
-> WITH GRANT OPTION;
Solution 7:[7]
I just encountered same problem a few minutes ago, i was sure i didnt need any configuration change so what i did was to clear cookies and site data from 127.0.0.1 (might be localhost instead, in your case) and it was solved!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Eric Aya |
| Solution 2 | Md Majadul Islam |
| Solution 3 | |
| Solution 4 | SULTAN |
| Solution 5 | Paul McCarthy |
| Solution 6 | user229044 |
| Solution 7 | Wogwugwu Zenith |


