I'm trying to simply connect to a MySQL database on my localhost With php and mysqli. But I'm encountering a problem.
I Wrote the code below
<?php
$sql = new mysqli('127.0.0.1:777','root','Qwert12345','plot_io_db');
//echo $sql->query('Select * From players');
?>
Assuming that all the information is correct (there is a MySQL server running and it includes a database with the name 'plot_io_db' and username and the password are correct), it still takes ages for the script to return results and it returns the following result
Warning: mysqli::__construct(): MySQL server has gone away in C:xampphtdocs estdefault.php on line 2
Warning: mysqli::__construct(): Error while reading greeting packet. PID=11092 in C:xampphtdocs estdefault.php on line 2
Warning: mysqli::__construct(): (HY000/2006): MySQL server has gone away in C:xampphtdocs estdefault.php on line 2
Fatal error: Maximum execution time of 30 seconds exceeded in C:xampphtdocs estdefault.php on line 2
My question is: Why does this happen and how to solve this.
P.S: I commented the third line just to bring the result time below ten minutes!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…