Wamp mysqli real_connect hy000/1045: access denied for user root@localhost (using password: no)

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


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?

Dharman

28k21 gold badges75 silver badges127 bronze badges

asked Oct 13, 2017 at 18:48

2

yo need create the user "pma" in mysql or change this lines[user and password for mysql]:

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma'; 
$cfg['Servers'][$i]['controlpass'] = '';

Linux: /etc/phpmyadmin/config.inc.php

User Rebo

1,51320 silver badges25 bronze badges

answered Mar 15, 2018 at 14:55

2

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.

Quill

2,6991 gold badge30 silver badges42 bronze badges

answered Apr 27, 2018 at 16:57

sam.stacksam.stack

5014 silver badges2 bronze badges

2

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';

answered Jan 14, 2019 at 6:03

Wasim KhanWasim Khan

1,10712 silver badges13 bronze badges

2

Add these lines to the file xampp\phpMyAdmin\config.inc:

$cfg['Servers'][$i]['controluser'] = 'root'; 
$cfg['Servers'][$i]['controlpass'] = '';

zx485

27.5k28 gold badges51 silver badges55 bronze badges

answered Aug 12, 2019 at 22:38

taufiktaufik

1991 silver badge8 bronze badges

My default 3306 port was in use, so I changed it to 8111, and then I had this error. I've fixed it by adding

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

into config.inc.php. If you are using a different port number then set yours.

Dharman

28k21 gold badges75 silver badges127 bronze badges

answered Aug 28, 2019 at 5:43

A. AskarovA. Askarov

5355 silver badges13 bronze badges

0

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';

answered Aug 13, 2019 at 16:50

User ReboUser Rebo

1,51320 silver badges25 bronze badges

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

answered Apr 15, 2020 at 15:30

The Connection for controluser as defined in your configuration failed, right after:

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'you_password';

El.Hum

1,4593 gold badges14 silver badges22 bronze badges

answered Aug 31, 2019 at 5:52

I experienced the same errors on a fresh install of VestaCP. I solved the issues by following the instructions on this video.

  1. Go to phpmyadmin-fixer and run the appropriate command.
  2. Restart Apache, NGINX and MySQL servers.
  3. That's it!

answered Nov 7, 2018 at 23:30

nicozicanicozica

4136 silver badges17 bronze badges

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.

answered Feb 27, 2019 at 12:26

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

Constant

5241 gold badge3 silver badges20 bronze badges

answered Apr 10, 2018 at 18:58

DanielDaniel

4,6273 gold badges26 silver badges31 bronze badges

I changed in file config.inc.php

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

to

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

and it worked!

consider changing host entry 127.0.0.1 to localhost or even the IP address of the server.

$cfg['Servers'][$i]['host']

Hassaan

6,8585 gold badges29 silver badges48 bronze badges

answered Dec 21, 2017 at 2:48

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]

answered Dec 28, 2019 at 19:18

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!

answered Apr 17, 2020 at 1:00

Jaime MontoyaJaime Montoya

6,1947 gold badges62 silver badges87 bronze badges

clear site data in your browser. and it will be fixed. sometimes when you run proxies, vpns or some other programs this error happens.

answered Nov 6, 2020 at 19:52

Amin AdelAmin Adel

9002 gold badges16 silver badges31 bronze badges

change the port number. I followed these steps and it worked for me

Port number in XAMPP can be easily changed by following this 5 steps:

step 1: stop the xampp server, if it is already running.[to avoid collapse]

step 2: run your notepad as administrator and open this 3 files:

  1. xampp/properties.ini

  2. xampp/mysql/bin/my.ini

  3. xampp/php/php.ini

step 3: Press ctrl+F and replace all 3306 [ port number ] with 3308[it can be anything like 3307 or 3309] .[ Use ctrl+F so that you don’t miss out any 3306 port unchanged. Otherwise it won’t work]

step 4 : save all the files.

step 5 : Now restart your apache and mysql. It will work :]

answered May 8, 2021 at 8:51

you have to change three places first you have password so please type your password of the server in $['password'] , $['controlpass']

here I believe these codes help you

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

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

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'yourPassword of server';

answered Dec 20, 2021 at 17:43

It is usually happens when you are facing problem when starting xampp server. The problem is some how like this....

Problem detected! 2:06:05 AM [mysql] Port 3306 in use by "Unable to open process"! 2:06:05 AM [mysql] MySQL WILL NOT start without the configured ports free! 2:06:05 AM [mysql] You need to uninstall/disable/reconfigure the blocking application 2:06:05 AM [mysql] or reconfigure MySQL and the Control Panel to listen on a different port

So first you have to change your port 3306 to 8111. how will you change it? simple go to my.ini file inside xampp/mysql/data and open it with note pad and change it.

After that if you try to start phpmyadmin you will face error access denied.

Now you also have to your port setting in your config.inc file. You will find it in xampp/PHPMyAdmin/Config.inc

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

after that start you xampp server again and refresh you web page it will work.

answered May 26 at 21:14

Chủ Đề