Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-20-2005, 03:05 PM   #1
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
php/mysql question

i try connect to a mysql database using the function mysql_connect("localhost","username","userpass") but i get this error: Access denied for user: 'root@localhost' (Using password: NO)

why the php is trying to connect with the user "root" and without password since username is other than root and i specify a password (for username) ?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 03:07 PM   #2
Jakke PNG
ex-TeenGodFather
 
Jakke PNG's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: Suomi Finland Perkele
Posts: 20,306
No idea, this works for me.

$link = mysql_connect("localhost", "root", "password")
or die("w00t w00t, error error");
mysql_select_db("database", $link)
or die("can't open db");
__________________
..and I'm off.
Jakke PNG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 03:16 PM   #3
Doc911
Confirmed User
 
Join Date: Feb 2004
Location: If i was up your ass you'd know
Posts: 3,695
try putting the real mysql ip in the localhost space
__________________


For PHP/MySQL scripts ICQ 161480555 or email [email protected]
Doc911 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 03:44 PM   #4
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
Quote:
Originally Posted by Doc911
try putting the real mysql ip in the localhost space
still not working
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 03:49 PM   #5
blazin
Confirmed User
 
Join Date: Aug 2002
Posts: 2,781
not familiar with PHP myself but it looks to me like your not passing the name of the database. Shouldn't you be connecting to a particular db?
__________________
I don't endorse a god damn thing......
blazin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 03:57 PM   #6
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
Quote:
Originally Posted by blazin
not familiar with PHP myself but it looks to me like your not passing the name of the database. Shouldn't you be connecting to a particular db?

mysql_select_db($dbname) will come after mysql_connect() function... but why i'm geting that mysql error? why is trying to connect as root when i specify a username?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 04:46 PM   #7
Doc911
Confirmed User
 
Join Date: Feb 2004
Location: If i was up your ass you'd know
Posts: 3,695
try assigning the user and password to a variable and putting the string in place
$host = "127.0.0.1:4321";
$user = blah;
$pass = blahblah;

mysql_connect($host, $user, $pass) ;
__________________


For PHP/MySQL scripts ICQ 161480555 or email [email protected]

Last edited by Doc911; 03-20-2005 at 04:49 PM..
Doc911 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 06:44 PM   #8
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
wrong password or dbname.
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 06:50 PM   #9
teksonline
So Fucking Banned
 
Join Date: Jan 2005
Location: At My Desk
Posts: 2,904
your file is not in the proper format

convert it to proper ascii format with proper line feeds
teksonline is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:24 PM   #10
Dynamix
G F Y not
 
Industry Role:
Join Date: Jan 2004
Location: MN
Posts: 2,910
Code:
$link = @mysql_connect("$DB_HOST", "$DB_USER", "$DB_PASS");
$db_selected = mysql_select_db($DB_DB, $link);
always works for me. set the variables above the connect line and you're good to go. check with your server admin, perhaps your databases aren't properly setup. It has nothing to do with the host IP as you're at least getting a reply.
__________________

TGPFactory Full TGP Design & Installation Services
ICQ 250 142 484 · AIM TGPDynamix · Email: patrick (at) tgpfactory (dot) com
See who I am at AdultWhosWho.com!
Dynamix is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:26 PM   #11
mike503
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: oregon.
Posts: 2,243
the quotes shouldn't be needed.
__________________
php/mysql guru. hosting, coding, all that jazz.
mike503 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:37 PM   #12
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
mysql_connect("localhost","username","userpass") but i get this error: Access denied for user: 'root@localhost' (Using password: NO)

THAT WILL NOT WORK try replacing it with this.


$_SESSION['dbhost'] = "localhost"; //
$_SESSION['dbusr'] = "xxxxx"; //
$_SESSION['dbpwd'] = "xxxxx"; //
$_SESSION['dbdb'] = "xxxxx"; //
$_SESSION['password'] = "xxxxx"; //
If that doesnt work contact me on icq i have another form also

Last edited by Pete-KT; 03-20-2005 at 08:38 PM..
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:40 PM   #13
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
This one works the best for me i just found it

// MySQL configuration
$CONFIG['dbserver'] = 'localhost'; // Your database server
$CONFIG['dbuser'] = 'xxxxxx'; // Your mysql username
$CONFIG['dbpass'] = 'xxxxxx'; // Your mysql password
$CONFIG['dbname'] = 'xxxxxx'; // Your mysql database name
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:44 PM   #14
mike503
Confirmed User
 
Industry Role:
Join Date: May 2002
Location: oregon.
Posts: 2,243
the fuck are you storing db parameters in the session for?

jesus people, learn how to code.

your last example will work, if he uses mysql_connect and mysql_select_db with the appropriate parameters. it won't just work like magic otherwise. of course, unless there's some database abstraction library or related script being loaded that reads those variables like that (highly unlikely with that setup.)
__________________
php/mysql guru. hosting, coding, all that jazz.
mike503 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:47 PM   #15
broke
Confirmed User
 
Join Date: Aug 2003
Location: Someplace Windy
Posts: 4,501
1. User/PWD not set up in MySQL.
2. Mistyped user name.
3. Mistyped password.

No other reason you would get an "Access denied" message.
__________________
Perfect Gonzo
broke is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-20-2005, 08:48 PM   #16
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
there in the session for the script thats being used by that coder, that wasnt one of my codes thats why i posted the second one for him .
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.