Check if the MySQL daemon is up and if the path to the socket is correct: this is defined in the configuration file of MySQL, i.e. /etc/mysql/my.cnf, in distro-specific configuration files, like /etc/mysql/debian.cnf, and in the PHP configuration file through pdo_mysql.default_socket=.
Cascading rule is applied: the PHP configuration overrides debian.cnf which overrides my.cnf.
The socket file is used to connect to the local server without passing from the TCP protocol, but you can force it by changing the host to the local IP address:
$pdo = new PDO("mysql:dbname=database;host=127.0.0.1", "username", "password");
Hi, I am a newbie in developing a website. i have tried to connect using mysqli conncetion
Here is my simple code.
// db.php code
//$con = mysqli_connect("localhost","root","","bakery"); ...
If you're in one of those predicaments where cls.__private attributes just aren't enough since they can easily be accessed through inst._cls__private, and you need something a little more secure, here's ...