MySQL and PHP: DATABASE PROGRAMMING


Intro to MySQL
MySQL is a powerful database processing package.

We provide initial setup of your MySQL database and the server software that supports it (we provide no techical support beyond setup). You must be fluent and educated in database and SQL languages yourself to take advantage of MySQL's features. Database programming is very specific and should not be entered into lightly.

MYSQL databases can be accessed via PHP (probably the most widely used method), myPHPadmin (which is a web control panel version of PHP, MsqlPerl, or via the MySQL prompt via SSH. PHP is a server-side processing languages which works very well in conjunction with mSQL databases. See the PHP handbook for documentation and command syntax.

Database creation:

Assuming your accout type has the abolity to use databases (please check with our staff or your account description), then you can create databases directly from your control panel.  Once connected proceed to the MySQL section to activate and name your database.  Make sure to add a username to your database or you won't be able to access it.  Please note that we do reserve the right to restrict database use if the processing power needed is deemed to be abusive to the server.

Database access:

Via the web: We have installed a powerful web interface that makes it very easy to administer your database. This interface, called phpMyAdmin, is based on the PHP scripting language and let's you create, drop, edit, and manage tables and data in your database.
You can read more on phpMyAdmin by going to http://www.phpwizards.net

Connect to phpMyAdmin by logging onto your control panel and then going to SQL Database -> phpMyAdmin.
Note: (phpMyAdmin does not stop the user from entering incorrect syntax, therefore it will accept a line like the one below even though it is incorrect)

Via the command line: You can access your database via PHP as mentioned, through software such as Microsoft MySQL for Windows, or via the telnet command line via the command mysql.  If you are accessing it through telnet, you may want to do a dump of the mysql help file.  To do this type the following:

mysql -? > mshelp.txt

This will create a text file call mshelp.txt that you can then read through any text editor such as pico.  For instance, after using the above command type pico mshelp.txt to read the help file.

Database backup:

It is important to periodically back up your database, as they can become corrupt.  Restoration is usually only possible if you have a backup handy.  Although we do maintain server backups it is done globally in the event of total server failure, so it is usually not possible to restore just one or two corrupt files on demand.  Make sure to save your backup to your local PC so you have a copy off of the internet, safe from any corruption.

To backup a MySQL database use the mysqldump command.  To read the help file on mysqldump, use the method used above and the following command:

mysqldump -? > msdumphelp.txt

Other Information: