Re: PHP on 2K / MySQL on LINUX

From: Date: Mon, 04 Sep 2000 07:34:27 +0000
Subject: Re: PHP on 2K / MySQL on LINUX
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15152@lists.php.net to get a copy of this message
If this works on the Linux box but fails on the W2K box, and assuming you don't get any php errors, I would say the problem is your user/passwd for the mysql server. MySQL has a very elaborate permissions system. As the administrator of the MySQL db you need to give the user of your web app permissions to access the database from the webserver. Assuming your web server is 192.168.0.2, your MySQL DB is 192.168.0.1, your userid is "dbuser", your passwd is "dbpasswd": GRANT SELECT PRIVILEGES on *.* to dbuser@192.168.0.2 identified by 'dbpasswd'; This should give the dbuser from 192.168.0.2 who connects with 'dbpasswd' the privileges to run any SELECT query on any db you have. Of course, I don't think this is great idea. Personally I prefer to limit remote users to specific dbs. However based on your application below it looks like you're allowing any user to read (SELECT) from any db. There's much much more you can do. For example the above GRANT won't allow a user to create a new row in a table. You should check out http://www.mysql.com/documentation/mysql/ -- Scott On Sun, Sep 03, 2000 at 06:48:12PM -0700, Daniel Guerrier wrote: > What is the procdure for getting my php page on W2K to > connect to my Linux MySQL database on a seperate box, > ona local network. > > If I have this page with the following on the local > LINUX with apache, it work OK. But if I try the same > page on W2K with IIS 5 it will not connect. > > <HTML> > <HEAD> > <TITLE>PHP SQL CODE TESTER</TITLE> > </HEAD> > <BODY> > <!-- query.php --> > > <?php > $host="192.168.0.1"; > $user="string"; > $password="string"; > ?> > > <FORM ACTION="mysql_test.php" METHOD=POST> > Please select the database for the query:<BR><BR> > <SELECT NAME=database SIZE=1 > > > <?php > mysql_connect($host, $user, $password); > $db_table = mysql_list_dbs(); > > for ($i = 0; $i < mysql_num_rows($db_table); $i++) > { > echo("<OPTION>" . mysql_tablename($db_table, $i)); > } > ?> > > </SELECT><BR><HR> > > Please input the SQL query to be executed:<BR><BR> > <TEXTAREA NAME="query" COLS=50 ROWS=10></TEXTAREA> > <BR><BR> > <INPUT TYPE=SUBMIT VALUE="Execute query"!> > </FORM> > > </BODY> > </HTML> > > __________________________________________________ > Do You Yahoo!? > Yahoo! Mail - Free email you can access from anywhere! > http://mail.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Scott

« previous php.general (#15152) next »