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?
– Godfrey the King
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];
– Godfrey the King
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.
– Rafael Andrade
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?
– Adriano Back
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– Adriano Back