I keep getting the following errors with mysql connection through XAMPP and I don't know what to do:
That's the code in the config.inc.php
<?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
*/
?>
I've already reset the password from MySql from the command line two times and added the changes to this code above and to the php.ini file, but at each time it goes back to the error. Any help?
This question is related to
php
mysqli
phpmyadmin
xampp
Might be late to the party - also, this answer is for LAMP users who got to this thread from google, like me.
Basically, the problem is PMA is trying to connect to SQL with a user that doesn't exist.
At /etc/phpmyadmin/config-db.php, you will find 2 variables: $dbuser, and $dbpass. Those specify the MySQL user and Password that PMA is trying to connect with.
Now, connect with some username/password that work (or just "root" if you are connecting from localhost), create a new user with global priviliges (e.g - %PMA User% with password %Some Random Password%), then in the above mentioned file set:
$dbuser = %PMA User% ;
$dbpass = %Some Random Password%;
You might also change other stuff there, like the server address ($dbserver), the port ($dbport, which might not be the default one on your machine), and more.
This error is caused by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php.
It seems when I installed phpMyAdmin using apt, the version in the repository (phpMyAdmin v4.6.6) is not fully compatible with PHP 7.2. There is a newer version available on the official website (v4.8 as of writing), which fixes these compatibility issues with PHP 7.2.
You can download the latest version and install it manually or wait for the repositories to update with the newer version.
Alternatively, you can make a small change to sql.lib.php to fix the error.
Firstly, backup sql.lib.php before editing.
1-interminal:
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
2-Edit sql.lib.php. Using vi:
sudo vi /usr/share/phpmyadmin/libraries/sql.lib.php
OR Using nano:
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
Press CTRL + W (for nano) or ? (for vi/vim) and search for (count($analyzed_sql_results['select_expr'] == 1)
Replace it with ((count($analyzed_sql_results['select_expr']) == 1)
Save file and exit. (Press CTRL + X, press Y and then press ENTER for nano users / (for vi/vim) hit ESC then type :wq and press ENTER)
In terminal, log into MySQL as root. You may have created a root password when you installed MySQL for the first time or the password could be blank, in which case you can just press ENTER when prompted for a password.
sudo mysql -p -u root
Now add a new MySQL user with the username of your choice. In this example we are calling it pmauser (for phpmyadmin user). Make sure to replace password_here with your own. You can generate a password here. The % symbol here tells MySQL to allow this user to log in from anywhere remotely. If you wanted heightened security, you could replace this with an IP address.
CREATE USER 'pmauser'@'%' IDENTIFIED BY 'password_here';
Now we will grant superuser privilege to our new user.
GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%' WITH GRANT OPTION;
Then go to config.inc.php ( in ubuntu, /etc/phpmyadmin/config.inc.php )
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pmauser';
$cfg['Servers'][$i]['controlpass'] = 'password_here';
I just finished setting up my XAMPP on the MAC and had the same trouble. I just fixed it. It is not quite clear what OS you're using but you need to run the XAMPP security. You indicate you've done that, but here it is anyway for the MAC
sudo /Applications/XAMPP/xamppfiles/xampp security
Set your password on the questions you get.
In you're phpmyadmin import the "create_tables.sql" .. Which can be found in the ./phpmyadmin/sql folder.
Next open the config.inc.php
file inside the ./phpmyadmin
folder.
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'you_password';
Make sure to log out and log in to reflect the changes within phpmyadmin
Add these lines to the file xampp\phpMyAdmin\config.inc
:
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
The Connection for controluser as defined in your configuration failed, right after:
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'you_password';
I am using UniServer Zero XIV 13.x.x UniController XIV V2.3.1:
From the command line I did this:
mysql> CREATE USER 'pmauser'@'%' IDENTIFIED BY 'MyPasswordHere!';
Query OK, 0 rows affected (0.07 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.02 sec)
Then I went to C:\...\wamp\ZeroXIV_unicontroller_2_3_1\UniServerZ\home\us_opt1\config.inc.php
and modified the file to have this:
/* PMA User advanced features */
//////////$cfg['Servers'][$i]['controluser'] = 'pma';
//////////$cfg['Servers'][$i]['controlpass'] = $password;
$cfg['Servers'][$i]['controluser'] = 'pmauser';
$cfg['Servers'][$i]['controlpass'] = 'MyPasswordHere!';
I restarted Apache and MySQL. The error is gone!
Linux / Ubuntu:
If installed phpmyadmin via apt:
sudo apt-get install phpmyadmin php-mbstring
Can check /etc/phpmyadmin/config-db.php
for changing the user credentials.
$dbuser='pma';
$dbpass='my_pass';
$basepath='';
$dbname='phpmyadmin';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysql';
I solved the problem by adding the line skip-grant-tables
to the my.ini:
# The MySQL server
[mysqld]
skip-grant-tables
port= 3306
...
Under XAMPP Control Panel > Section "MySQL" > Config > my.ini
clear site data in your browser. and it will be fixed. sometimes when you run proxies, vpns or some other programs this error happens.
I experienced the same errors on a fresh install of VestaCP. I solved the issues by following the instructions on this video.
consider changing host entry 127.0.0.1
to localhost
or even the IP address of the server.
$cfg['Servers'][$i]['host']
if your port is 3307 (based on your port)
Add this line in xampp\phpMyAdmin\config.inc: after i++
$cfg['Servers'][$i]['port'] = '3307';
My default 3306 port was in use, so Ive changed it to 8111, then I had this error. Ive fixed it by adding
$cfg['Servers'][$i]['port'] = '8111';
into config.inc.php . If you are using different port number then set yours.
Add this line to the file xampp\phpMyAdmin\config.inc
:
$cfg['Servers'][$i]['port'] = '3307';
Here, my port is 3307
, you can change it to yours.
Source: Stackoverflow.com