2016-06-12 3 views
-2

警告:mysqli :: mysqli(HY000/1045):C:\ wamp \ www \のユーザー 'root' @ 'localhost'(パスワードは:YES)ライン上のMCTRの\のをdb.php 6PHP mysqlデータベース1045のアクセスが拒否されました

にしようとしたとき、私はこのエラーを得た私は、インターネット上の人々がやったと固定することをconfig.incに変更を加えることを試みたが、私にとってdidntの仕事は

を助けます接続とテーブルの作成

my db接続

<?php 
$servername = "localhost"; 
$username = "root"; 
$password = " "; 

$conn = new mysqli($servername, $username, $password); 

if ($conn->connect_error) { 
    die("1: " . $conn->connect_error); 
} 
echo "2"; 
?> 

私の作成・テーブル・ファイル

<?php 
    require_once "db.php"; 
    $t = "CREATE TABLE uyeler (
    id INT(7) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 
    isim VARCHAR(16) NOT NULL, 
    kullanici_adi VARCHAR(15) NOT NULL, 
    sifre VARCHAR(16) NOT NULL, 
    email VARCHAR(50) NOT NULL, 
    skype VARCHAR(20) NULL, 
    uye_tipi enum('Üye','Yönetici','Kurucu') NOT NULL default 'Üye', 
    UNIQUE KEY email (email), 
    UNIQUE KEY kullanici_adi (kullanici_adi), 
    tolpam_indirilme INT(7) NULL, 
    aylik_indirilme INT(7) NULL, 
    kayit_tarihi TIMESTAMP 
    )"; 

    $querySonucu = mysql_query($t); 

    if($querySonucu === TRUE){print "Basarili!";} else{print "Hata!";} 
    mysql_close(); 
?> 

私のconfig.inc.phpを

<?php 

/* Servers configuration */ 
$i = 0; 

$cfg['blowfish_secret'] = 'a8b7c6d'; //What you want 

/* Server: localhost [1] */ 
$i++; 
$cfg['Servers'][$i]['verbose'] = 'Local Databases'; 
$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['auth_type'] = 'cookie'; 
$cfg['Servers'][$i]['user'] = ''; 
$cfg['Servers'][$i]['password'] = ''; 

// Hidden databases in PhpMyAdmin left panel 
// $cfg['Servers'][$i]['hide_db'] = '(information_schema|mysql|performance_schema|sys)'; 

// Allow connection without password 
$cfg['Servers'][$i]['AllowNoPassword'] = true; 

// Suppress Warning about pmadb tables 
$cfg['PmaNoRelation_DisableWarning'] = true; 

// To have PRIMARY & INDEX in table structure export 
$cfg['Export']['sql_drop_table'] = true; 
$cfg['Export']['sql_if_not_exists'] = true; 

$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman/5.7/en/'; 
/* End of servers configuration */ 

?> 
+0

として設定されていることが、あなたのデータベースが期待するユーザー名とパスワードを持っていますか? (パスワードを投稿しないでください) –

+0

あなたはデータベースを選択せず​​、MySQL APIを混在させています。かなり明白 –

答えて

1

DB接続ファイルにあります。必ずパスワードを

$password = ""; 

なく

$password = " "; 
0

パスワードを確認しましたか? ""を使用しているようです。つまり、単一のスペースです。たとえば標準設定のxamppの場合、パスワードは空です ""

関連する問題