Difficulty connecting to MySQL - How to give permission?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
PuteraSiong
Forum Newbie
Posts: 1
Joined: Wed Sep 10, 2008 5:09 am

Difficulty connecting to MySQL - How to give permission?

Post by PuteraSiong »

I have installed MySQL through PHPTriad2-2-1 and find difficulty in connecting to MySQL database. When I run php program connet.php
<?php
//contoh koneksi database MySQL
//Meyambung guna mysql_connect
$sambung = mysql_connect("localhost");
//Jika berhasil masuk ke Database maka nilai
//$sambung 1
//jika tak boleh sambung nilai $sambung 0
if ($sambung){
echo ("koneksi berhasil");
} else {
echo ("koneksi tak berhasil");
}
?>
I got the message:
"Warning: Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\apache\htdocs\sku3063\connect.php on line 4".
Please give some advice to overcome this.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Difficulty connecting to MySQL - How to give permission?

Post by josh »

setup a user account using the grant syntax (or your hosts control panel), and connect using hte optional username and password params on mysql_connect.
Post Reply