NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

connect to php on XAMPP

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
NewNet



Joined: 24 Aug 2009
Posts: 74

PostPosted: Fri Sep 04, 2009 10:46 am    Post subject: connect to php on XAMPP Reply with quote

[code]<?php
$con = mysql_connect("localhost","root","test");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("mysql", $con);

$result = mysql_query("Select * from User", $con);

while($row = mysql_fetch_array($result))
{
echo $row['User'] . " " . $row['Host'];
echo "<br />";
}

mysql_close($con);
?>[/code]
[b]Could not connect: Access denied for user 'root'@'localhost'I got error on [/b]
Back to top
sidewinder



Joined: 04 Sep 2009
Posts: 4

PostPosted: Fri Sep 04, 2009 11:28 am    Post subject: connect to php on XAMPP Reply with quote

Only problem I see here might be with password. Xampplite doesn't use
root password for mysql by default. Did you set it to 'test'?

Quote:
Code:
<?php

$con = mysql_connect("localhost","root","test");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}



mysql_select_db("mysql", $con);



$result = mysql_query("Select * from User", $con);



while($row = mysql_fetch_array($result))

{

echo $row['User'] . " " . $row['Host'];

echo "<br />";

}



mysql_close($con);

?>


Could not connect: Access denied for user 'root'@'localhost'I got error on










Back to top
NewNet



Joined: 24 Aug 2009
Posts: 74

PostPosted: Mon Sep 07, 2009 3:13 am    Post subject: Reply with quote

Dear sidewinder,
You are right, I delete my Xammp and reinstall it , then my password is null , then the connection work,
[b]do I have to left the root password to "" I try to creat a new password and user but just get the same error , why??
[/b]
Back to top
NewNet



Joined: 24 Aug 2009
Posts: 74

PostPosted: Mon Sep 07, 2009 4:03 am    Post subject: Reply with quote

after I retry the password I can connect to db by php code , but
when I run http://localhost/phpmyadmin/
I got [b]#1045 - Access denied for user 'root'@'localhost' (using password: NO)[/b]
why Crying or Very sad
by the way if I install Xampp lit , can i still ron mysql on Command Pronmpt Crying or Very sad ??
thank you
Back to top
sidewinder



Joined: 04 Sep 2009
Posts: 4

PostPosted: Mon Sep 07, 2009 5:00 pm    Post subject: connect to php on XAMPP Reply with quote

Go to your xampplite directory, then to phpmyadmin. Find
config.inc.php. In this file you can set your username, password and
authorization method (default is config). As an alternative go to
127.0.0.1/xampp and then on the left side there must be something
related with security. Under that tab you can set mysql password and
it will automaticaly change your phpmyadmin authorizaton method
(cookie or browser only). For more information check this
http://www.phpmyadmin.net/documentation/Documentation.html#config

I hope that helps. Good luck.

ps.

Yes you can use console to manage your mysql dbs in xampplite. Console
client is in either xamplite/mysql/bin or xampplite/bin or
/xamplite/apache/bin. Im away from my comp and i cant remember exactly
where executables are placed.


Quote:
after I retry the password I can connect to db by php code , but

when I run http://localhost/phpmyadmin/

I got #1045 - Access denied for user 'root'@'localhost' (using password: NO)

why [Crying or Very sad]

by the way if I install Xampp lit , can i still ron mysql on Command Pronmpt [Crying or Very sad] ??

thank you










Back to top
NewNet



Joined: 24 Aug 2009
Posts: 74

PostPosted: Wed Sep 09, 2009 2:55 am    Post subject: Reply with quote

Thank you,
after I set the following change
Code:
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type']            = 'http';
$cfg['Servers'][$i]['user']                 = 'root';
$cfg['Servers'][$i]['password']             = 'test';
$cfg['Servers'][$i]['AllowNoPassword']      = true;

/* Server parameters */
$cfg['Servers'][$i]['host']             = 'localhost';
$cfg['Servers'][$i]['connect_type']     = 'tcp';
$cfg['Servers'][$i]['compress']         = false;

my php admin become Window authorization?
right not is not error , but I still don't understand , why it become Window authorization?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo