Failed Connection error using cpanel in mysql

Using cpanel I created the following:

New database called: sil_accts_1

username called: sil_admin1

password called: mypass213
I then used the SELECT SHA1(‘mypass213’); to get an encrypted password t1125gghke21

In a auth00.php page I have

<?php 

    // Enable us to use Headers
    ob_start();
    
  
$con = mysqli_connect("localhost","sil_admin1","t1125gghke21","sil_accts_1");

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

I get the infamous Warning: mysqli_connect(): (HY000/1045): Access denied for user ‘sil_admin1’@‘localhost’ (using password: YES) in /home/myfile/public_html/auth00.php on line 7
Failed to connect to MySQL: Access denied for user ‘sil_admin1’@‘localhost’ (using password: YES)

  1. Am i inserting the wrong information in the con statement?
  2. Is it better to not use cpanel for the connection now that that php under 7 is now outdated? I do see many
    posts about this but nothing that specifically addresses my issue
    The connection info is altered for security purposes

What makes you think you would need to do that to get the value you use in your application code as the connection password, vs using the actual password you created of mypass213?

Sponsor our Newsletter | Privacy Policy | Terms of Service