LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   MySQL/php problem (https://www.linuxquestions.org/questions/fedora-35/mysql-php-problem-297973/)

Basslord1124 03-05-2005 11:06 AM

MySQL/php problem
 
I've been having a rather weird problem. I set up my Linux box as sort of a home web/mysql server so I can work on some of my school projects at home. Here's my problem:

I set up a database (chris) that I have full access to. I can connect to the chris database from my Windows computer using MySQL Control Center without a problem. I set up a php file so I can also access the database but everytime the php script executes it tells me it failed to connect. And I am quite sure everything is entered in correctly in the php script. Any ideas?

david_ross 03-05-2005 11:11 AM

What error do you get from "mysql_error()"?

What grant statement did you use to give the user you are connecting as access to the database?

Basslord1124 03-05-2005 11:16 AM

Well before the error was just a hard coded if/else that indicated if the connection was successful. It would always say it didn't connect. I took that part of the statement out and it appears to execute...odd.

I used a grant all privelges to the chris database from our subnet (192.168.0.%) identified by the password. Not the most secure but it worked for me before.

Basslord1124 03-05-2005 11:18 AM

Just checked my webpage which uses the php/mysql....pages render fine but they don't pull what they need from the database. They don't pull anything actually.

david_ross 03-05-2005 11:33 AM

If it is on the same server then you will need to allow connections from localhost as well.

Basslord1124 03-05-2005 12:13 PM

Still no luck unless I am entering in the commands wrong.

Basslord1124 03-05-2005 06:32 PM

Crap...now I can't even log in on the linux machine. Tells me chris or root is denied from localhost.

david_ross 03-06-2005 08:58 AM

Can you post the exact error message you get if you try to login on the command line.

Basslord1124 03-06-2005 02:34 PM

ERROR 1045: Access denied for user 'root@localhost' (Using password: NO)

david_ross 03-06-2005 02:37 PM

Did you not set a password for the mysql root user?

Basslord1124 03-06-2005 02:41 PM

I thought I did....I happened to stumble across a script while browsing the net last night about it...mysql_setpermission or something like that and did it that way. Of course if I actually use the password option and put it in I can log in....I just thought being logged in as root I could access mysql without having to reenter the password.

EDIT: Basically all I want is to able to do log in through command line on linux either as root or chris (although more chris than anything) and have all acess to the database....both from Linux and my XP machine.

david_ross 03-06-2005 02:44 PM

No. The user databases are completely seperate.


All times are GMT -5. The time now is 06:41 PM.