Page 1 of 2
mysql_connect() not working [SOLVED]
Posted: Sun Jan 30, 2005 1:44 pm
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?
Posted: Sun Jan 30, 2005 2:00 pm
by magicrobotmonkey
you are using the wrong username/pass in connecting to the db
Posted: Sun Jan 30, 2005 2:01 pm
by James M.
there is no username or password
Posted: Sun Jan 30, 2005 2:37 pm
by magicrobotmonkey
well perhaps thats the problem!
Posted: Sun Jan 30, 2005 2:41 pm
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.
Posted: Sun Jan 30, 2005 9:01 pm
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.
Posted: Sun Jan 30, 2005 9:07 pm
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
Posted: Sun Jan 30, 2005 9:16 pm
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.
Posted: Sun Jan 30, 2005 9:18 pm
by magicrobotmonkey
dp you have phpmyadmin?
Posted: Sun Jan 30, 2005 9:20 pm
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
Posted: Sun Jan 30, 2005 9:28 pm
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
Posted: Sun Jan 30, 2005 11:14 pm
by magicrobotmonkey
where did you get this copy of mysql from? you might want to look through some docs for default usernames.
Posted: Sun Jan 30, 2005 11:29 pm
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.
Posted: Mon Jan 31, 2005 11:34 am
by ProfMoriarty
I'm pretty sure the default password is "password".
Posted: Mon Jan 31, 2005 12:42 pm
by James M.
I thought maybe it was too, but it failed

. Nothing seems to be working.