Access error denied for user in connection

Asked

Viewed 420 times

0

Can anyone tell me why I’m finding this mistake ?

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'clienteaces'@'localhost' (using password: YES) in C: Program Files (x86) Easyphp-Devserver-17 eds-www Company Hard_php to_db.php on line 24

Warning: mysqli_error() expects Parameter 1 to be mysqli, Boolean Given in C: Program Files (x86) Easyphp-Devserver-17 eds-www Company Hard_php to_db.php on line 26

Code:

$ip = '127.0.0.1';
$conta = 'clienteaces';
$pass = 'abcdef123456';
$db = 'hard'; 



$conexao = mysqli_connect($ip,$conta,$pass,$db);
if(!$conexao){
   die("Não Conectado : ". mysqli_error($conexao)); 
   echo "O formulario não foi preenchido tente novamente mais tarde...";    
}
else{
    $sql = mysqli_query($conexao,"INSERT INTO 'contato' (nome) values ('$nome')");
    $sql = mysqli_query($conexao,"INSERT INTO 'contato' (email) values ('$email')");
    $sql = mysqli_query($conexao,"INSERT INTO 'contato' (assunto) values ('$assunto')");
    $sql = mysqli_query($conexao,"INSERT INTO 'contato' (mensagem) values ('$mensagem')");
    
    echo "Mensagem enviada obrigado logo estaremos entrando em contato!";
    echo "<input type='button' name='voltar' value='Voltar' href='../index.html'>";
}
?>

Since in the database I created a user with this name and password with the correct privileges.

  • You can make the connection with another user?

  • You can also use DBMS preferably or the same terminal user permissions. Printe and put in your question. How to do? SHOW GRANTS FOR [USER];

  • I don’t know easyPHP, but I’ll risk a guess here, if he has phpmyadmin access it and go to user accounts, choose your created user and go to edit privileges, finally locate these 3 columns (Data |Structure|Administration) and make sure that all options are marked.

  • First of all, thanks to everyone who sent me the answers, I was able to connect to the database through a default user called 'root' so you can finish and adjust, now I will really check if I need to guarantee all rights to the user but this would not imply in the security of the database?

  • the code was as follows include "239839djcie48com.php"; to connect the db of another file and $conexao = mysqli_connect($ip,$conta,$pass,$db); to connect I believe this helps in security

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.