I have installed XAMPP on my Ubuntu 14.0.04 and I'm trying to connect to my MySQL server from PHP file but I'm getting an error:
Warning: mysql_connect(): No such file or directory in /opt/lampp/htdocs/value.php on line 3
not connected
my value.php
file contains
<?php
$con = mysql_connect('localhost:3307', 'root', '');
if ($con) echo 'Connected';
else echo 'not connected';
---
?>
and my MySQL server is up and running and my server is also running.
Which version of mysql are you using?
Try this
127.0.0.1:your-port-number
like
$con = mysql_connect('127.0.0.1:3307', 'root', ''); // or 3306 whatever your port number is
instead of localhost
I too had this problem, but this link helped me Warning: mysql_connect()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With