php - Need help sorting out MySQL permissions and connections -


so i'm trying set php site accesses , writes database. should relatively simple i've become swamped mess of permission issues , i'm new php i'm not sure how fix them all.

first off, warning occurs when trying access database:

warning: mysqli_connect(): server requested authentication method unknown client [mysql_old_password] 

the connection fails due this:

warning: mysqli_connect(): (hy000/2054): server requested authentication method umknown client 

in research found warning related password hashing due versioning of php (link)

however attempting run solution on page gives me following error:

error code: 1044. access denied user 'user'@'host' database 'mysql'   

and don't know how gain permissions in database.

here's php code reference (sensitive info removed):

$con=mysqli_connect("ip:port","user","password","database_name"); // check connection if (mysqli_connect_errno($con)) { echo "failed connect mysql: " . mysqli_connect_error(); } else {     echo "succesfully connected"; echo "<br />"; }  $result = mysqli_query($con, "select * owners") or die("error: ".mysqli_error($con)); while($row = mysqli_fetch_array($result)) {   echo $row['email'] . " " . $row['type']; echo "<br />"; } 

can me out one? know it's lot seems of issues related , i'm not sure start fixing them. (i'm using xampp run php , mysql workbench run queries)

i suppose mysql running on different machine in network. try see if works:

create user 'user'@'ip' identified 'your password'; grant on database_name.* 'user'@'ip'; 

if user in system different ip should create again using ip of mysql server. try % instead of ip in create user , grant statements not recommended in production.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -