简体   繁体   中英

php MySQL database - access denied

im using phpmyadmin to access my database but when i try to access the website i am getting the following error:

     MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

the code to connect the php to sql is the following:

    <?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 3.2.5 setup script by Piotr Przybylski <piotrprz@gmail.com>
 * Date: Sun, 21 Feb 2010 12:43:50 +0100
 */

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['nopassword'] = true;

$cfg['Servers'][$i]['AllowNoPassword']      = true;
$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';




/* End of servers configuration */

$cfg['blowfish_secret']  = 'noFb57s3pq83MQVUDh9D2YLve1r8kUL2Bs27q32uBekGEzD33iTYs757G2nMt7n8';
$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = './tmp/';
$cfg['SaveDir'] = './tmp/';
$cfg['CheckConfigurationPermissions'] = false;
$cfg['AllowUserDropDatabase'] = true;


$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman/5.1/en';
$cfg['MySQLManualType'] = 'searchable';

?>

the connection is a local one and there is no password to enter it, therefore i believe that the database should authenticate and authorize the access, original it used to work fine, but now and for some reason, i get access denied. any help is appreciated.

Password or Username is incorrect in this case. Try confirming this and try connecting again. The given script uses the following credentials:

Username:root

Password:< None >

Probably you are missing the correct password

First, verify if you have another MySQL instance installed. It occurred to me.

If you have only one MySQL in your system and if you're using something like WAMP, open your config.inc.php and look for the password.

It's not good idea to use root account by your applications. Always use different users for your apps! At least one for each app.

I bet that MySQL blocks root login.

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

what worries me is "using password: NO" - root without password?

Try to create new user, grant him permissions to database that you're working on and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM