dousi2251 2013-04-27 20:04
浏览 263

php MySQL数据库 - 访问被拒绝

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.

  • 写回答

3条回答 默认 最新

  • dstk51319 2013-04-27 20:32
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮