Monday, February 25, 2008

Testing whether mySQL work

After you know that PHP is running okay, you can test whether you can access MySQL by using PHP. Just follow these steps:
  • Create the following file somewhere in your Web space with the name mysql_up.php. You can download the file from http://mihd.net/i5pmy9
  • The following lines 9, 10, and 11 of the program need to be changed:
$host=”host”;
$user=”mysqlaccount”;
$password=”mysqlpassword”;
  • Change host to the name of the computer where MySQL is installed —for example, databasehost.mycompany.com. If the MySQL database is on the same computer as your Web site, you can use localhost as the hostname.
  • Change mysqlaccountname and mysqlpassword to the appropriate values. An account named root is installed when MySQL is installed, which may or may not have a password. If your MySQL account doesn’t require a password, type nothing between the quotes, as follows:
$password=””;
  • Point your browser at mysql_up.php. You should see a table with a long list of variable names and values. You don’t want to see an error message or a warning message. Don’t worry about the contents of the table. It’s only important that the table is displayed so that you know your connection to MySQL is working correctly. If no error or warning messages are displayed, MySQL is working fine. If you see an error or a warning message, you need to fix the problem that’s causing the message.
The following is a common error message:

MySQL Connection Failed: Access denied for user:
‘user73@localhost’ (Using password: YES)

This message means that MySQL did not accept your MySQL account number or your MySQL password. Notice that the message reads YES for Using password but doesn’t show the actual password that you tried for security reasons. If you tried with a blank password, the message would read NO. If you receive an error message, double-check your account number and password. Remember that this is your MySQL account number — not your account number to log on to the computer. If you can’t connect with the account number and password that you have, you might need to contact the IT department or the Web hosting company that gave you the account number.

No comments:

 
breast-cancer diabetes-informa... weight-losse lung-mesotheliom... eating-disorders medical-billing php-and-mysql skin-cancer medical-health astronomy-guide cancer-diseases health insurance seo-news-2008 forex3003 lawyer-lookingforalawyer earnmoneyonline-earn forexautotrading-forex forex-trade forextrading forex-trading-forex-trading-08 searchingforcancertreatment adsense jiankang8008 beauty-girl forex5005