![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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) ? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
ex-TeenGodFather
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
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
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
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...... ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
Quote:
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? ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
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) ; |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Too lazy to set a custom title
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
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);
__________________
![]() 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! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
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 .
|
![]() |
![]() ![]() ![]() ![]() ![]() |