MySQL problem

Techwhore

Golden Member
Aug 2, 2000
1,248
0
0
I posted awhile ago and received some help but there's a different problem now.

I've created a PHP web-based interface for easy data entry into a SQL database. The problem is that I do my web hosting on a different machine than the SQL server.

SQL Server = Win2k
PHP Web Hosting = Red Hat 7.1

When i submit data through the web form, i receive:

Warning: MySQL Connection Failed: Access denied for user: 'remnant@gateway.lan' (Using password: YES)

Obviously there's something that needs to be setup on my SQL server, but what and how?

remnant = username to SQL via PHP
gateway.lan = hostname of RH 7.1

I installed MySQL server on RH but i can't seem to start the daemon and webmin says it's not installed... so until i can figure that one out, i can't use localhost for serving.

Thanks in advance.
 

kt

Diamond Member
Apr 1, 2000
6,032
1,347
136
Make sure the user you setup is allowed logging in from another machine. By default, MySQL will set user to be logged in locally. There's a field in the user table that specify where the user may login from. Replace the entry for that field with "%" to allow login from anywhere.

 

guaraguao

Member
May 21, 2001
159
0
0


<< Warning: MySQL Connection Failed: Access denied for user: 'remnant@gateway.lan' (Using password: YES) >>



You want to go to the mysql console, and type

GRANT ALL on MYDB.* TO remnant@% IDENTIFIED BY 'mypassword'


--Where MYDB is the database you're using, and the user's password is 'mypassword'.

(This is exactly what kt told you to do)

good luck
 

Techwhore

Golden Member
Aug 2, 2000
1,248
0
0
Thanks for the help, but i'm still having trouble.


mysql> grant all on supplements.* to remnant@% identified by 'mypassword';
ERROR 1064: You have an error in your SQL syntax near '% identified by 'mypassword' ' at line 1


If i change the @% to read @gateway or @gateway.lan it goes through without errors but the script still gives the same login error when run. :(
 

guaraguao

Member
May 21, 2001
159
0
0


<< mysql> grant all on supplements.* to remnant@% identified by 'mypassword';
ERROR 1064: You have an error in your SQL syntax near '% identified by 'mypassword' ' at line 1
>>



try grant all on supplements.* to remnant identified by 'mypassword' -- I looked it up in my mysql book, and if you put nothing after the username it is the same thing as if you put %.
 

Techwhore

Golden Member
Aug 2, 2000
1,248
0
0


<< try grant all on supplements.* to remnant identified by 'mypassword' -- I looked it up in my mysql book, and if you put nothing after the username it is the same thing as if you put %. >>


Thanks, that did the trick! That's a pretty good book apparently, what's the name? I'm interested in learning more, i only know the basics of MySQL from the lessons at Devshed.

One more quick question while i can.

This database is for the backend of my soon-to-be website, i don't want to pay for hsoting until at least the database is functional so i'm going to need to import the db. I think I read about it a little and found something that said dump the database, is that right? It's going to be pretty large and i would hate to have to recreate it. If it's difficutl to do, i'll just buy hosting now.
 

guaraguao

Member
May 21, 2001
159
0
0


<< This database is for the backend of my soon-to-be website, i don't want to pay for hsoting until at least the database is functional so i'm going to need to import the db. I think I read about it a little and found something that said dump the database, is that right? It's going to be pretty large and i would hate to have to recreate it. If it's difficutl to do, i'll just buy hosting now. >>


If you get a halfway decent provider, they will have phpmyadmin setup or something similar.
You go to your mysql server, and type into a terminal: mysqldump MYDATABASE > myfile
It's that simple. If you have phpmyadmin at the place you're hosting, you can just "import database", and upload that text file--it's pretty sweet!

If you have to do it yourself from a shell (I haven't done it before), then it'll probably be something like
cat MYFILE | mysql -u USERNAME -p PASSWORD MYDATABASE

This will will print the contents of MYFILE (which is presumably your backup file) into a mysql shell, and insert all your tables and data. Hopefully, you won't have to screw with that though, like I said there will probably be a nice web interface.

Edit: Oh yeah, and my book is simply titled "MySQL." It is by Paul DuBois and published by New Riders. I found it at a local Kudzu used book store chain--you should be able to find it in any halfway decent book store, I would hope.
 

Techwhore

Golden Member
Aug 2, 2000
1,248
0
0
Great, I'll look at the features of my prospective hosting service again... they offer a lot so i'd imagine phpmyadmin will be there.

I'll also take a look for that book.

Thanks for all the help
 

Hullboy

Member
Apr 18, 2001
172
0
0
Techwhore

I just purchased that book a week ago, and so far I'm happy.

I'm only 120 pages in, but the style is lucid, laid-back but still very detailed. So far, I'd say it's very good. Especially compared to the other few books out there on mySQL, which didn't look as good............

New Riders continue to impress me.

Only 350 pages to go!!! :Q **(excluding appendixes)**