Accessing a mySQL Database
Task:
I've already requested a mySQL database. How do I access it to make changes?
How to do it:
You can issue queries to the mySQL database either via an SSH session, via MySQL Control Center or directly from a PHP script.
NOTE: The campus firewall blocks off-campus traffic on port 3306. To connect to your AU mySQL database, you must be logging in from a machine on campus (such as mallard.auburn.edu) or running the AU VPN client.
Follow these steps:
- To access your database through SSH, open an SSH session or application (SecureCRT is recommended), connect to the OIT Sun Network (mallard.auburn.edu) and enter the following command:
mysql -h web6 -u username -p
Replace username with the one specified in your confirmation e-mail. Supply your password when prompted and press Enter.
When you get a mysql> prompt, type in the following:
use name; - To access a mySQL database through a PHP script, insert the following code inside the PHP script:
Replace name with the database name in your confirmation e-mail. You're now connected to your mySQL database via telnet.
<?
mysql_connect("$DBHost","$DBUser","$DBPass") or die("Unable to connect to server");
mysql_select_db("$DBName") or die("Unable to select database");
?>
Assign $DBHost to the database host name (web6.duc.auburn.edu), $DBUser to the username in the confirmation e-mail, $DBPass to the password, and $DBName to the database name.
You can now start issuing queries from the PHP script.
Common Topic: Requesting a mySQL database
