9AF Posted February 21, 2003 Share Posted February 21, 2003 I have recently started to work on MySQL, PHP and apache and I\'m still finding my way round. Having installed apache 2.0.44 (successfully), with MySQL 4.0 and PHP 4.3.2 I found this script which is suppose to help show that all works with PHP/MySQL. The code is: <html> <head><title></title></head> <body> <?php $host=\"localhost\"; $user=\"pj\"; $password=\"buzz\"; mysql_connect($host, $user, $password); $db_table = mysql_list_dbs(); for ($i = 0; $i < mysql_num_rows($db_table); $i++) { echo(mysql_tablename($db_table, $i)); echo(\" \"); } ?> </body> </html> However, I keep on getting this error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user: \'rb@127.0.0.1\' (Using password: YES) in C:Program FilesApache GroupApache2htdocstest.php on line 8 mysql test Is this test that I\'m trying to do valid? If so what have I done wrong. Any feedback would be much appreciated. Regards 9AF Quote Link to comment https://forums.phpfreaks.com/topic/174-q-on-mysqlphp/ Share on other sites More sharing options...
pallevillesen Posted February 21, 2003 Share Posted February 21, 2003 It\'s not your test, it\'s your access that is the problem... You probably have a special password set for the user pj@localhost... That\'s the error anyway... Try and connect with mysql -h localhost -u pj -p buzz from a terminal window... And/Or browse the mysql:user table... Hope this helps, P. Quote Link to comment https://forums.phpfreaks.com/topic/174-q-on-mysqlphp/#findComment-500 Share on other sites More sharing options...
shivabharat Posted February 21, 2003 Share Posted February 21, 2003 Check the my.ini file and u will see the password u have set. Quote Link to comment https://forums.phpfreaks.com/topic/174-q-on-mysqlphp/#findComment-503 Share on other sites More sharing options...
9AF Posted February 22, 2003 Author Share Posted February 22, 2003 Thanks for the responses. I have managed to solve the problem by using user \'root\' and a password set to user \'root\'. The PHP code runs fine now. Though I did set a user and a password using mysqladmin for some reason nothing happened (defnitely something to do with permissions). In the documentation it does state somewhere to use user \'root\' when first using a new installation of MySQL as it has all the permissions set already. Thanks again for your help its much appreciated. 9AF Quote Link to comment https://forums.phpfreaks.com/topic/174-q-on-mysqlphp/#findComment-506 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.