,
:: ADNplanet Home Page ::
Bookmark this site Contac Us
Home Help
Questions and Answers Register Login
// Home // Support Home // Questions and Answers // Scripts & Programming // How do I use mySQL to create & maintain databases, tables, etc?
Search
Subscriptions
Submit Article
Category Jump:

Question Ref
6437-MFZI-8429
Article Created by
fabian
Article Created
Sun, 1st Aug 2004 5:42 pm
Article Updated by
fabian
Article Updated
Sun, 1st Aug 2004 6:12 pm


Receive Email Updates
Printable Version
E-mail Article
Add a Comment
// How do I use mySQL to create & maintain databases, tables, etc?
  Question    
How do I use mySQL to create & maintain databases, tables, etc?
  Answer    
You can use mySQL databases in our servers.
Following you can get a mySQL Guide to use it :


-
Overview of MySQL database.
- Creating/Deleting/Editing Databases and Users.
- Connecting to MySQL through Perl using the MySQL Perl Module.
- Connecting to MySQL through PHP.
- Restrictions and other information..
- The Official MySQL Documentation .
- Backing up a MySQL Database

--------------------------------------------------------------------------------


Overview of MySQL database. --- (Go to Top)

The MySQL database server is a very robust, SQL based platform that is provided for use with the standard or higher plans. It is often utilized as a data source for Web sites requiring dynamic content. The languages most often used to interface with the database server are Perl and PHP, however, C, C++, and Python among others may also be used. The official MySQL Web site may be found at:http://www.mysql.com


Creating/Deleting/Editing Databases and Users --- (Go to Top)

All administration of your MySQL databases and users can be done through our convenient web based phpMyAdmin interface. This program is provided to all of our Web hosting customers. It is available in your Control Panel (CP).


Connecting to MySQL through Perl using the MySQLPerl Module --- (Go to Top)

Use the following outline to connect and begin querying the MySQL server from a Perl script.
Remember that you cannot connect to your databases remotely due to security concerns, you can only connect from localhost.

Declarations
You must require the MySQL package for your script to function properly. Do this by including the following line in your code: use mysql;

Connect To The Database
Somewhere near the beginning of your script, you need to make your initial connection to the database server. Using the following form, substitute your database, username, and password for the examples to connect successfully. The database must be a valid one that you have created through the phpMyAdmin interface in the CP. The username must be one created in MyAdmin with adequate permissions to the specified database.
Mysql->connect('localhost','DATABASENAME','USERNAME','USERPASSWORD');

Executing A Query
You are now ready to begin querying the database server. Most problems that you may incur will generally occur due to invalid permission settings for the specified user. Remember that you can use our convenient web based MyAdmin interface to view or edit these settings.


Connecting to MySQL through PHP --- (Go to Top)

Use the following outline to connect and begin querying the MySQL server from within your PHP scripts. Remember that you cannot connect to your databases remotely due to security reasons. You can only connect to them form localhost.

Connect to the MySQL server
Use the following statement to connect to the database server. Substitute the username, and
password for ones who have created in the MyAdmin interface and have given adequate
permissions to this database.
MYSQL_CONNECT('localhost','USERNAME','PASSWORD');

Select Your Database
Use the following statement to select the database you wish to connect to. Make sure you
substitute the example with your database name.
@mysql_select_db("DATABASENAME");

Executing A Query
You are now ready to execute your queries. Remember that the databases and users used must be created in the MyAdmin interface in your CP. Most problems that arise with your scripts will be due to incorrect permission settings.


Restrictions and other information --- (Go to Top)

The following restrictions are currently affective regarding all of our webhosting accounts:

You cannot connect to any of your databases from remote hosts. This limitation is due to security concerns. For now you may only connect from localhost.

You may not utilize the data-infile data-outfile functions of the MySQL server. This is due to security reasons.


The Official MySQL Documentation --- (Go to Top)

The official MySQL documentation may be found at: http://www.mysql.com

Other useful information about MySQL may be found at the following locations:

The MySQL User's Documentation Project
Developer's Shed


Backing up a MySQL Database via phpMyAdmin interface --- (Go to Top)

To access the phpMyAdmin interface, click on the "mySQL Databases" link and then "phpMyAdmin" on your control panel.

How to back up a mySQL database using phpMyAdmin:

Click on your database name shown on the upper left.

Go to the section called "View dump (schema) of database" and choose options for backing up structure only, structure and data, or adding drop tables. To view what your backup file will look like, click on the "Go" button. When you're ready to send your back up to a file, check the send box and click "Go", then follow the prompts for how to name the file and where to send it.

How to restore a mySQL database using phpMyAdmin:

Click on your database name shown on the upper left.

Locate your back up file for the database that you want to restore. Open it and copy the entire contents.

Paste into the field called "Run SQL query/queries on database yourdomain_com" and click the "Go" button.
  How helpful was this answer?
100% 80% 60% 40% 20% 0%

| Home | Questions and Answers | Register | Login |
 
Powered by ADNTECH HD v1.0
Copyright ©1997 - 2004, ADNGROUP