NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
NewNet
Joined: 24 Aug 2009 Posts: 74
|
Posted: Fri Sep 04, 2009 10:46 am Post subject: connect to php on XAMPP |
|
|
[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
|
Posted: Fri Sep 04, 2009 11:28 am Post subject: connect to php on XAMPP |
|
|
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
|
Posted: Mon Sep 07, 2009 3:13 am Post subject: |
|
|
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
|
Posted: Mon Sep 07, 2009 4:03 am Post subject: |
|
|
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
by the way if I install Xampp lit , can i still ron mysql on Command Pronmpt ??
thank you |
|
| Back to top |
|
 |
sidewinder
Joined: 04 Sep 2009 Posts: 4
|
Posted: Mon Sep 07, 2009 5:00 pm Post subject: connect to php on XAMPP |
|
|
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
|
Posted: Wed Sep 09, 2009 2:55 am Post subject: |
|
|
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 |
|
 |
|
|
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 can attach files in this forum You can download files in this forum
|
|