• Register
0 votes
2.4k views

Problem :

I keep getting a below error with mysql connection through a XAMPP and I really don't know what to do:

Mysqli_real_connect(): (hy000/1045): access denied for user 'pma'@'localhost' (using password: no)

I have already reset my password from a MySql from a command line three times and added a changes to my code and to my php.ini file, but at each time it goes back to a error. Any help on this issue?

7 5 2
3,870 points

2 Answers

0 votes

Solution :

In your terminal, log into the MySQL as root. You may have created the root password when you had installed MySQL for a first time or a password could be blank, in each case you can simply press ENTER when prompted for your password.

 sudo mysql -p -u root

Now add your new MySQL user with a username of your choice. In this example we are reefing it as pmauser (for the phpmyadmin user). Make sure to replace the  password_here with your own. You can now generate a password here. A % symbol here tells the MySQL to allow your user to log in from anywhere remotely. If you wanted to heightened security, you could replace it with the IP address.

CREATE USER 'pmauser'@'%' IDENTIFIED BY 'password_here';

Now we will grant the superuser privilege to your new user.

GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%' WITH GRANT OPTION;

Then go to the config.inc.php ( in your ubuntu, /etc/phpmyadmin/config.inc.php )

/* User for the advanced features */

$cfg['Servers'][$i]['controluser'] = 'pmauser'; 
$cfg['Servers'][$i]['controlpass'] = 'password_here';
9 7 4
38,600 points
0 votes

Sometimes we get to see this error “mysqli_real_connect(): (hy000/1045): access denied for user 'root'@'localhost' (using password: no)” while we try to connect to our MySQL in xampp. This error message means that the connection to the database is not correct or you may have set different passwords for the user 'root' or have changed your password.

Solution:

There are many ways to solve this problem. Let’s see different ways of solving this problem.

Change your configuration file:

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

To

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

Or, we can use:

/* Authentication type and info */
$cfg['Servers'][$i]['password'] = '';<----your password

Or, We can change:

/* User for advanced features */

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

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

To

/* User for advanced features */

$cfg['Servers'][$i]['controluser'] = 'your user';

$cfg['Servers'][$i]['controlpass'] = 'your password';

 

 

 

10 6 4
31,120 points

Related questions

0 votes
1 answer 201 views
201 views
Problem : I am currently using the Mac OS Yosemite and Laravel 5.0. I am new to Laravel 5.0. In the local environment whenever I run the below command php artisan migrate I always encounter below error : &ldquo;Access denied for user 'homestead'@'localhost' (using password: YES)&rdquo; I am unable to fix above error. Any clue to fix the above error?
asked Feb 13 mphil 2.3k points
0 votes
1 answer 68 views
68 views
Problem : I am new to MySql. The problem started when I was unable to login to Mysql using my Mysql console. It is repeatedly asking me the password and now I am unable to remember my password. Can I change my password ? And now when I am trying to open my PhpMyAdmin ... WAMP and after that deleted all my related files and then reinstalled it .But it did not fix my issue. How can I fix the issue ?
asked Feb 26 mphil 2.3k points
0 votes
1 answer 351 views
351 views
Problem : I have recently installed Ubuntu 16.04 and installed web server on it. Everything works well, but I am unable to access database. Even if I create new user and grant all privileges, I can't create database In PHP I am getting below error: SQLSTATE[HY000] [1698] ... ", $this->myname, $this->mypass, self::$mysettings);     } catch (PDOException $e) {         echo $e->getMessage();     } }
asked Jan 17 jwilliam 3.9k points
0 votes
2 answers 526 views
526 views
Problem : Whenever I want to open a mysql in my windows cmd by simply typing mysql. I am facing below error : &ldquo;ERROR 1045 (28000): Access denied for user ODBC@localhost (using password: NO)&rdquo; After that by looking at similar queries I somehow got the ... password=root ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password:NO) Any pointers will be the great help.
asked Dec 18, 2019 alecxe 7.5k points