When I install xampp and run my php file, i found this error :
Connection Error: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
this is my connection :
<?php
$server="localhost";
$host="127.0.0.1";
$uname="root";
$prefix="";
$pass="admin";
$dbname="sample";
try{
$conn=new PDO("mysql:host=$server;dbname=$dbname","{$prefix}{$uname}",$pass);
// echo $conn;
}catch(PDOException $e){
echo "Connection Error: ".$e->getMessage();
die();
}
?>
Then i think i forgot to start the mysql in xampp controller. Then I open xampp controller then I found this red in xampp console:
11:40:29 AM [mysql] MySQL Service detected with wrong path
11:40:29 AM [mysql] Change XAMPP MySQL and Control Panel settings or
11:40:29 AM [mysql] Uninstall/disable the other service manually first
11:40:29 AM [mysql] Found Path: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini" MySQL
11:40:29 AM [mysql] Expected Path: c:\xampp\mysql\bin\mysqld.exe --defaults-file=c:\xampp\mysql\bin\my.ini mysql
Then I search to solve this error. almost said that I uninstall the Mysql then I try to uninstall it but error comes :
11:40:45 AM [mysql] Uninstalling service...
11:40:45 AM [mysql] MySQL Service detected with wrong path
11:40:45 AM [mysql] Change XAMPP MySQL and Control Panel settings or
11:40:45 AM [mysql] Uninstall/disable the other service manually first
11:40:45 AM [mysql] Found Path: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini" MySQL
11:40:45 AM [mysql] Expected Path: c:\xampp\mysql\bin\mysqld.exe --defaults-file=c:\xampp\mysql\bin\my.ini mysql
11:40:45 AM [mysql] Service was NOT (un)installed!
Actually I had installed mysql5.1 before I install xampp, because I doing projects in java. I am new from php, and I don't know what to do. Please help me guys. I really need help. Thank you in advance :')