Error mysqli_connect(): (42000/1044): Access denied for user

Asked

Viewed 2,120 times

2

This code is going wrong.

Warning: mysqli_connect(): (42000/1044): Access denied for user 'u469236901_roota'@'10.2.1.41' to database 'u469236901_sysU' in /home/u469236901/public_html/Registerunity.php on line 7

Warning: mysqli_error() expects Parameter 1 to be mysqli, Boolean Given in /home/u469236901/public_html/Registerunity.php on line 7 Error

I want to make a system of Registry and login in Unity.

<?php
    
$email = $_POST['email'];
$nome = $_POST['name'];
$senha = $_POST['passoword'];

$con = mysql_connect("mysql.hostinger.com.br","usuario_retirado","senha_retirada") or die("Error " . mysql_error($con));

$check = "SELECT * FROM SystemLR_unity" or die("Error in the consult.." . mysql_error($link));
$numrows = mysql_num_rows($check);
$result = mysqli_query($con, $check); 
if ($numrows > 0)
{

    $senha = md5($senha);
    $ins = mysql_query("INSERT INTO SystemLR_unity (  `id` ,  `email` ,  `nome` ,  `senha` ) VALUES ('' ,  '".$email."' ,  '".$nome."' ,  '".$senha."') ; ");
    if ($ins)
        die ("User Criado Com Susseco!");
    else
        die ("Error: " . mysql_error());
    
}
else
{
    die("Este User Ja Existe!");
}


?>
  • This error occurs when your user and password are wrong or the user you created has no privileges, if you are trying to connect to the host via localhost, your home ip is probably not cleared.

  • Probably the error is at your user’s access level. I tested the code and connected normally on my local server!

  • I believe that that answer solve the problem

  • You left your username and password exposed in the code, I removed them for your safety. Take care when exposing this information, review your code before putting on the internet.

  • About the same problem Mysql Query in PHP only works locally and

1 answer

3


I had the same problem 2 hours ago and it was also at Hostinger :O To solve the problem I did the following: I left the same hosting and mysql password and exchanged mysql.hostinger.com.br for localhost

  • The change to localhost is that it must have solved. Mysql authorizes access by user and host.

  • Thanks, fused I switched the pass and the host and merged, but still appears an error Deprecated: mysql_connect(): The mysql Extension is deprecated and will be Removed in the Future: use mysqli or PDO Instead in /home/u469236901/public_html/Runregisteity.php on line 7 User Created With Susseco!

  • @Vralago Good afternoon, if you translate the message you will have something like: mysql_connect is out of use and will be removed in the future, use mysqli or PDO instead, the use of the api mysql_* will be discontinued, in its place you can use the new API called mysqli or the class PDO.

Browser other questions tagged

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