note 2975 deleted from mysql_connect by danbeck
| From: | danbeck@php.net | Date: | Thu, 07 Sep 2000 15:25:53 +0000 |
| Subject: | note 2975 deleted from mysql_connect by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4354@lists.php.net to get a copy of this message | ||
In reply to:
Other people with an account on the system where you store your php file can see your password to
the MySQL database by simply looking at your php file. I cannot figure out a way to avoid this
because in order to post your php page on the Web, you have to give other people the read access to
you file. Does anybody can help me solving this problem?
There is no need to use your own password to give others access to your database. You should create
a webuser in the mysql database and give him read privileges.
For instance do:
<PRE>
GRANT usage ON your-database.* TO webuser@localhost;
</PRE>
this creates a user called webuser who can connect only from localhost, and can connect to the
database called your-database.
You now want to allow this user to (for example) insert and select from your-database:
<PRE>
GRANT insert, select ON your-database.* to webuser@localhost;
</PRE>
notice that the * after your-database allows your user to use all the tables in your-database. If
you want to allow him to use only (for example) table called feedback, you would write
your-database.feedback
Hope this helps you.