mysql_connect() not working [SOLVED]

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

mysql_connect() not working [SOLVED]

Post by James M. »

I am starting to use php and I can't seem to get mysql to work for me. I am running php 4.3.10, apache 2.0, and mysql 4.1.9. My harddrive got erased but i had backups of my php files so i installed php, apahce and mysel on the new harddrive. When tried running a page with a call to mysql_connect it always gives me the error:
Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Apache Group\Apache2\htdocs\project2\login.php on line 7
Could not connect to database server
does anyone know whats goign on?
Last edited by James M. on Tue Feb 01, 2005 1:34 am, edited 1 time in total.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

you are using the wrong username/pass in connecting to the db
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

there is no username or password
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

well perhaps thats the problem!
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

My mysql doesn't have a password and user name set, unless this version of mysql sets a user name and password i dont know about.
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

How would i go about finding out if i have a password and username for mysql, the version i had before had this monitor tool that gave me info like that, but this version is just cmd programs.
thegreatone2176
Forum Contributor
Posts: 102
Joined: Sun Jul 11, 2004 1:27 pm

Post by thegreatone2176 »

i never used apache but check to see in your have a config.php or connect.php in your files and if you do open them in some sort of a text editor.

also if you were able to create a database from this program you should be able to add users for it
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

I created the tables and all a long time ago, they aren't the problem. I can't connect to mysql at all.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

dp you have phpmyadmin?
thegreatone2176
Forum Contributor
Posts: 102
Joined: Sun Jul 11, 2004 1:27 pm

Post by thegreatone2176 »

ok well basically your error is saying you dont have permission and you arent using a password

so first of recode your connect statement so you have a password and then if you still get the error make sure your user has proper permissions for whatever you are doing
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

I don't have phpmyadmin, and i have never set up a username or password for mysql (i dont even see that option anymore). This is running off my computer by the way.

edit: i can't even access the databse from mysyladmin.exe, gives me the same error
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

where did you get this copy of mysql from? you might want to look through some docs for default usernames.
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

It says that root is the default user name but even when I use that it tells me access denied still. They say nothing about a default password.
ProfMoriarty
Forum Newbie
Posts: 7
Joined: Wed Dec 29, 2004 5:09 pm
Location: Juneau, AK

Post by ProfMoriarty »

I'm pretty sure the default password is "password".
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

I thought maybe it was too, but it failed :( . Nothing seems to be working.
Post Reply