-1

I am using WAMP Server for android registration page development. I am getting this error:

Access denied for user 'root'@'localhost' (using password: YES)

Please help me in fixing this.

Here Is my Config.inc.php file :

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in documentation in the doc/ folder
 * or at <http://docs.phpmyadmin.net/>.
 *
 * @package PhpMyAdmin
 */

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;



/*
 * phpMyAdmin configuration storage settings.
 */

// No warning on  pmadb tables
$cfg['PmaNoRelation_DisableWarning'] = true;


?>

Here is the Config.php file:

<?php

/**
 * Database config variables
 */
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASSWORD", "root");
define("DB_DATABASE", "android_api");
?>

Here is my exact issue : enter image description here

  • you used the wrong password. you specified it as an empty string in the config, but obviously the server doesn't have "no password" on the root account. – Marc B Jul 13 '16 at 15:47
  • 3
    Possible duplicate of [Access denied for user 'root'@'localhost' while attempting to grant privileges. How do I grant privileges?](http://stackoverflow.com/questions/8484722/access-denied-for-user-rootlocalhost-while-attempting-to-grant-privileges) – olibiaz Jul 13 '16 at 15:47
  • @MarcB if i type any password in that field i can even open the php admin page entire page is getting this error if i do that – Rohith Manchikalapati Jul 13 '16 at 15:54
  • If the `root` user account ___has no password___ then leave the phpMyAdmin `password` field EMPTY. Dont **make up** a password there is no password _currently_ – RiggsFolly Jul 13 '16 at 16:00
  • i just edited my post and added my prblem screenshot plz checkout – Rohith Manchikalapati Jul 13 '16 at 16:26
  • YOu are getting an unknown database error which means you have not yet created the database android_api. Create it through phpmyadmin first. – Amit Ray Jul 13 '16 at 16:33
  • SO now you do need to use `phpMyAdmin` to create a database, and one or more tables. Maybe you should start with a simple MYSQL tutorial or book. https://www.amazon.co.uk/gp/offer-listing/0470527587/ref=tmm_pap_used_olp_sr?ie=UTF8&condition=used&qid=&sr= – RiggsFolly Jul 13 '16 at 16:37

1 Answers1

1

Unless you have ADDED a password to the root userid then by default it comes out of the box without a password.

So just put

define("DB_USER", "root");
define("DB_PASSWORD", "");

Or just leave the password field in phpMyAdmin blank and hit the GO button

RE: Your comment: I am using phpMyAdmin

Then the screen should look like this

enter image description here

Enter root in Username and leave the password: field empty

Then press the GO button

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149