/    Sign up×
Community /Pin to ProfileBookmark

i can’t to connect database mysql with php,

Hi:
I can’t to connect database mysqli with php. I a using localhost with XAMPP. i can only connecty using localhost, without username and password. If i just put localhosat i can access, but i can’t create database. so i don’t what to do. Here is my script.
<?php
// Crea la conexión
$con=mysqli_connect(“localhost”,”hugo”,”******”);

// Checa la conexión
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}
else
{
echo “Se conecto a la BD.<p>”;
}
?>

And this is error message

Warning: mysqli_connect(): (HY000/1045): Access denied for user ‘hugo’@’localhost’ (using password: YES) in C:xampphtdocsConnect.php on line 8
Failed to connect to MySQL: Access denied for user ‘hugo’@’localhost’ (using password: YES)

Anyway thanks for read this question and have a nice day.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 12.2014 — Have you in fact created a MyQL user with that name and password yet?
×

Success!

Help @toro23 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...