$query="SELECT name FROM test_table";
$db = mysql_connect("host", "user","passw");
mysql_select_db("dbname",$db);
$qry_result = mysql_query($query);
while($row = mysql_fetch_array($qry_result)){
echo"$row[name]";
}
mysql_close($db);
Your PHP file is using the use apache is running as to MySQL as the MySQL account name.What? After reading this sentence about 5 times, I think it's trying to say something like "Your PHP file is passing the apache user to MySQL as the MySQL account name."
I have used all the connection details IT provided me.Is your apache webserver running on the same machine as the mysql database? MySQL differentiates accounts based on where you're connecting from, so if you have server A running MySQL and server B running apache+mod_php, you need to have your IT people grant connect to user@B (not user@locahost).
I can connect command line and I have cronjobs to do backups that also work.
grant [privileges] on yourdb.* to user@webpages;grant [privileges] on yourdb.* to user@'192.168.0.12';[privileges] is a list of your privileges (e.g., select, create, insert, update, index). Of course, they need to replace yourdb, user, '192.168.0.12' with the appropriate values.You are not logged in, either login or create an account to post comments
They've given you a username and password and hostname for use with MySQL.
For what possible reason would you decide you don't want to use them?
posted by genghis at 1:31 PM on June 15