Forum Moderators: coopster
I'm using PHP to build the front end to the db on a G4 iMac running Panther. Everything works as expected while I use my own (standard) account. I grab the resultset and post the data into an HTML table.
$link = mysql_connect("localhost", "Dad", "password")
or die("Could not connect : " . mysql_error());
However, from my dear wife's (administrator) account, the table cells are empty, no data from mySQL.
I don't think the user_name or password is an issue because I can use the shell to run the "Dad" mySQL account from "Mom" UNIX account.
I tried the "wildcard" for host with this result:
Could not connect : Unknown MySQL Server Host '%' (22)
I'm pretty much out of my league here, the permissions in mySQL seem to be correct. Anyone have any thoughts on this?
you can allow/specify privileges through PHP MyAdmin
I'm using PHP to build the front end to the db on a G4 iMac running Panther. Everything works as expected while I use my own (standard) account. I grab the resultset and post the data into an HTML table.
Something funky is going on, since I do this frequently on my Macs without trouble.
$link = mysql_connect("localhost", "Dad", "password")
or die("Could not connect : " . mysql_error());However, from my dear wife's (administrator) account, the table cells are empty, no data from mySQL.
So she's gettting to the Web page, the Web page loads, but with blank table rows? Does your "Could not connect" error appear?
I don't think the user_name or password is an issue because I can use the shell to run the "Dad" mySQL account from "Mom" UNIX account.
That's right. You should even be able to connect from a Web server on a different computer this way (assuming you change "localhost" to your computer's IP address.)
I tried the "wildcard" for host with this result:Could not connect : Unknown MySQL Server Host '%' (22)
If you are successfully connecting with "localhost" as the host name, we can leave that alone for now.
I'm pretty much out of my league here, the permissions in mySQL seem to be correct. Anyone have any thoughts on this?
Maybe take a closer look at the PHP or SQL code, or even the HTML code that is output to the page. Echoing your SQL query to your Web page can solve a lot of mysteries.
FYI, Mac OS X has 2 kinds of login users, Administrators and non-Administrators. It looks like "Mom" and "Dad" are both administrators in this case. (Apple makes getting root access difficult, except through
sudo.) But even non-Administrators should be able to run the Web page -- just tested it here.
Without that error, it would seem that your permissions are fine.
Worst-case scenario, as MySQL admin:
grant insert,select,delete,update,drop,create on databasename.* to Dad@localhost identified by 'password';
Regardless of any other security measures in the Mac OS, if that's where the installation is running, this should allow Dad full access to the database.
Please post the rest of your code, from the connection to the db through the data gathering attempt to the closing of the db connection. That will help us help you better.
:)
REALLY stupid!
I was calling the page from the Mom account as a file
file:///Users/Dad/script.php.
Should be:
[127.0.0.1...]
I'm too embarrassed to post the actual code, this was the first of about 15 scripts I wrote. By the fifteenth script, I had things under better control. No more 7 resultsets from the same table [giggle].
Thanks everyone for your input and thanks jatar_k for your hard work.