Re: MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I just add the PHP code which brings to this same error. Not sure where I should post it:
<?php
$firstname = $_POST['first_name'];
$familyname = $_POST['family_name'];
$birthdate = $_POST['birthdate'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$phonenumber = $_POST['phone_number'];
$password = $_POST['pass'];
$passrepeat = $_POST['pass-repeat'];
if (!empty($firstname) || !empty($familyname) || !empty($birthdate) || !empty($gender) || !empty($email)
|| !empty($phonenumber) || !empty($password) || !empty($passrepeat))
{$hostname = "localhost";
$username = "ricardo";
$password = "";
$dbname = "ricardo";
$conn = new mysqli ($hostname, $username, $password, $dbname);
if (mysqli_connect_error()) {
die('Connect Error('. mysqli_connect_errno().')'. mysqli_connect_error());
}
else {$SELECT = "SELECT e_mail FROM registration WHERE e_mail = ? Limit 1";
$INSERT = "INSERT INTO registration (first_name, family_name, birthdate, gender, email, phone_number, pass, pass-repeat)
values (?,?,?,?,?,?,?,?)";
$stmt = $conn ->perpare($SELECT);
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result();
$stmt->store_result();
$rnum = $stmt->num_rows;
if ($rnum==0){
$stmt->close();
$stmt->bind_param("ssissss", $firstname, $familyname, $birthdate, $gender, $email, $phonenumber, $password, $passrepeat);
$stmt->execute();
echo "New record inserted successfully";
}
else {
echo "Someone already register using this email";
}
$stmt->close();
$conn->close();
}
} else { echo "All fields are required";
die();
}
?>
Ricardo Mastrangelo Wrote:
-------------------------------------------------------
> I have the same issue, I did the command and got
> something different. It's the first time I use
> mysql though. Thanks for the help up to now. I
> have been stuck for the past two days trying to
> linkl the forms on my website to my databases.
>
> mysql> show variables like '%auth%';
> +-------------------------------+-----------------------+
> | Variable_name | Value
> |
> +-------------------------------+-----------------------+
> | default_authentication_plugin |
> caching_sha2_password |
> +-------------------------------+-----------------------+
> 1 row in set (0.01 sec)
>
> mysql> select host, user, authentication_string
> from mysql.user;
> +-----------+------------------+------------------------------------------------------------------------+
> | host | user |
> authentication_string
> |
> +-----------+------------------+------------------------------------------------------------------------+
> | localhost | mysql.infoschema |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED
> |
> | localhost | mysql.session |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED
> |
> | localhost | mysql.sys |
> $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED
> |
> | localhost | root |
> $A$005$'"'-76 biO1Wm
> ukQDkmQ5aVM/LUwrq5NKbxOXoYVqX8O4eML4lr6SFbe4 |
> +-----------+------------------+------------------------------------------------------------------------+
> 4 rows in set (0.00 sec)