Jump to main contentmickwood.com - Website Hosting & Design for Christian Organisations
Support

"If we don't know it's broken we can't fix it!"

Support FAQ Homepage

Can't find the answer?

Databases

  1. How do I connect to MySQL through ASP?
  2. How do I connect to my MySQL databases through PHP?
  3. How do I convert a Microsoft Access database to a MySQL database?
  4. How do I create a MySQL user?
  5. How do I create a MySQL database using the Wizard?
  6. How do I manually create a MySQL database?
  7. How do I delete a MySQL database?
  8. How do I repair a MySQL database?
  9. How do I setup remote access to my MySQL databases?
  10. How do I use phpMyAdmin?
  11. How do I connect to a MySQL database through Perl?

1. How do I connect to MySQL through ASP?

Overview

When you want to connect to a database from an ASP page, the first step is to create the connection string. This provides information (in the form of parameters and their values) that is required for the server to establish the connection.

DSN-less connection strings: With a DSN-less connection string, you specify all of the required database information in the connection string.

Steps

The following example shows a DSN-less connection string for a MySQL database:

 connect_string = "Driver={Mysql};Server=localhost;Port=3306;Database=[database_name];UID=[username];PWD=[password]"

where[database_name]is the name of the database, and [username] and [password]are the username and password required for accessing the database.

Back to top


2. How do I connect to my MySQL databases through PHP?

Use the following outline to connect and query the MySQL server from within your PHP scripts.

1. Connect To The mySQL Server

Use the following statement to connect to the database server. Substitute the username, and password for the ones you created.

MYSQL_CONNECT('localhost','USERNAME','PASSWORD');

2. Select Your Database

Use the following statement to select the database. Make sure you substitute the example with your database name.

@mysql_select_db("DATABASENAME");

For a video tutorial about accessing your MySQL database through PHP, please go to How to connect to MySQL database using PHP.

Back to top


3. How do I convert a Microsoft Access database to a MySQL database?

There is a program called exportSQL that will assist you with converting a Microsoft Access database to a MySQL database.

Back to top


4. How do I create a MySQL user?

Overview

There are two primary steps when creating a MySQL user. The first step is to create a username and password combination for the user. The second step is to add the user to the database you want the user to access.

Steps

  1. In the "New User" section, enter the username and password you want to use for this database in the "Username" and "Password" text boxes, respectively.
  2. Next, click on the Create User button.
  3. You should see the following statement:Click on the Go Back link.
    • "Added USERNAME with the password PASSWORD."
  4. Find the "Add User To Database" section. Select the user you created in Step 6 above from the "User" drop down menu. Then select the database you want to add the user to from the "Database" drop down menu.
  5. Next, click on the Submit button.
  6. When the page loads you will see a two-column table. The top of the table provides a checkbox option "ALL PRIVILEGES" allowing you to create the database with all privileges, otherwise you can check each of the items in the two columns that you want to allow for your new database. The options include:
    • SELECT (Allows USERNAME to select data from a table in the database.)
    • INSERT (Allows USERNAME to insert data into a table in the database.)
    • UPDATE (Allows USERNAME to update data in a table in the database.)
    • DELETE (Allows USERNAME to delete data from a table in the database.)
    • INDEX (Allows USERNAME to create index on table column in the database. This can speed up a database.)
    • CREATE TEMPORARY TABLES (Allows USERNAME to create temporary tables in the database.)
    • CREATE (Allows USERNAME to create tables in the database.)
    • ALTER (Allows USERNAME to alter tables in the database.)
    • DROP (Allows USERNAME to drop tables in the database.)
    • LOCK TABLES (Allows USERNAME to lock tables in the database.)
    • REFERENCES (Allows USERNAME to create references to a table in the database.)

NOTE: Typically you may want to check the "All Privileges" option unless you want specific control over the user you are creating for this database.

  1. Assuming you have either checked the "All Privileges" option or a combination of the options in the two columns, continue the wizard by clicking on the Make Changes button.
  2. You should see the following statement:Click on the Go Back link.
    • "User USERNAME was added to the database DATABASE."
  3. You should now see the user you created in Step 1 above in the "Users" column.

Back to top


5. How do I create a MySQL database using the Wizard?

Overview

MySQL databases allow you to store lots of information in an easy to access manner. The databases themselves are not easily read by humans. MySQL databases are required by many web applications including some bulletin boards, content management systems, and others. To use a database, you'll need to create it. Only MySQL Users (different than mail or other users) that have privileges to access a database can read from or write to that database.

There are two ways to create a MySQL database The easiest way to create a MySQL database is to use the MySQL Database Wizard built directly into the cPanel interface. The second way involves a few more steps, but does not require you to go through the wizard.

Create A MySQL Database Using The Wizard (see video below)

Steps

  1. When the page loads, enter the name of your new database in the "New Database" text box.
  2. Next, click on the Next Step button.
  3. You should see the following statement:Enter the username and password you want to use for this database in the "Username" and "Password" text boxes, respectively.
    • "Added the database YOUR_DATABASE_NAME."
  4. Next, click on the "Next Step" button.
  5. You should see the following statement:
    • "Added USERNAME with the password PASSWORD."
  6. When the page loads you will see a two-column table. The top of the table provides a checkbox option "ALL PRIVILEGES" allowing you to create the database with all privileges, otherwise you can check each of the items in the two columns that you want to allow for your new database. The options include:
    • SELECT - Allows USERNAME to select data from a table in the database.
    • INSERT - Allows USERNAME to insert data into a table in the database.
    • UPDATE - Allows USERNAME to update data in a table in the database.
    • DELETE - Allows USERNAME to delete data from a table in the database.
    • INDEX - Allows USERNAME to create index on table column in the database. This can speed up a database.
    • CREATE TEMPORARY TABLES - Allows USERNAME to create temporary tables in the database.
    • CREATE - Allows USERNAME to create tables in the database.
    • ALTER - Allows USERNAME to alter tables in the database.
    • DROP - Allows USERNAME to drop tables in the database.
    • LOCK TABLES - Allows USERNAME to lock tables in the database.
    • REFERENCES - Allows USERNAME to create references to a table in the database.

NOTE: Typically you may want to check the "All Privileges" option unless you want specific control over the user you are creating for this database.

  1. Assuming you have either checked the "All Privileges" option or a combination of the options in the two columns, continue the wizard by clicking on the Next Step button.
  2. You should see the following statement:
    • "User USERNAME was added to the database DATABASE.",
  3. When the page loads you will have three available options to choose:
    • Add another database - Click this link if you want to add another MySQL database to your web hosting account.
    • Add another user using the MySQL Database Area - Click this link if you want to add another user to the database you created in the steps above.
    • Return to Home - Click this link if you want to return to the cPanel dashboard.

Back to top


6. How do I manually create a MySQL database?

Overview

MySQL databases allow you to store lots of information in an easy to access manner. The databases themselves are not easily read by humans. MySQL databases are required by many web applications including some bulletin boards, content management systems, and others. To use a database, you'll need to create it. Only MySQL Users (different than mail or other users) that have privileges to access a database can read from or write to that database.

There are two ways to create a MySQL database The easiest way to create a MySQL database is to use the MySQL Database Wizard built directly into the cPanel interface. The second way involves a few more steps, but does not require you to go through the wizard.

Steps

  1. When the page loads, enter the name of your new database in the "New Database" text box.
  2. Next, click on the Create Database button.
  3. You should see the following statement:Click on the Go Back link.
    • "Added the database YOUR_DATABASE_NAME."
  4. When the page loads, you will see a table with your newly created database containing the following information, split into five columns:In the "New User" section, enter the username and password you want to use for this database in the "Username" and "Password" text boxes, respectively.
    • Database - This entry will be the database name you created in Step 1 above.
    • Size - This entry will be the size of the database you created in Step 1 above.
    • Users - This entry will be the users in the database you created in Step 1 above. When you first create a new database manually, this column entry will be empty. Continue to Step 6 below to learn how to create and add a user to your new database.
    • Actions - You have one choice:
      • Delete Database - Click on this link to delete a database.
  5. Next, click on the Create User button.
  6. You should see the following statement:Click on the Go Back link.
    • "Added USERNAME with the password PASSWORD."
  7. Find the "Add User To Database" section. Select the user you created in Step 6 above from the "User" drop down menu. Then select the database you created in Step 1 above from the "Database" drop down menu.
  8. Next, click on the Submit button.
  9. When the page loads you will see a two-column table. The top of the table provides a checkbox option "ALL PRIVILEGES" allowing you to create the database with all privileges, otherwise you can check each of the items in the two columns that you want to allow for your new database. The options include:
    • SELECT - Allows USERNAME to select data from a table in the database.
    • INSERT - Allows USERNAME to insert data into a table in the database.
    • UPDATE - Allows USERNAME to update data in a table in the database.
    • DELETE - Allows USERNAME to delete data from a table in the database.
    • INDEX - Allows USERNAME to create index on table column in the database. This can speed up a database.
    • CREATE TEMPORARY TABLES - Allows USERNAME to create temporary tables in the database.
    • CREATE - Allows USERNAME to create tables in the database.
    • ALTER - Allows USERNAME to alter tables in the database.
    • DROP - Allows USERNAME to drop tables in the database.
    • LOCK TABLES - Allows USERNAME to lock tables in the database.
    • REFERENCES - Allows USERNAME to create references to a table in the database.

NOTE: Typically you may want to check the "All Privileges" option unless you want specific control over the user you are creating for this database.

  1. Assuming you have either checked the "All Privileges" option or a combination of the options in the two columns, continue the wizard by clicking on the Make Changes button.
  2. You should see the following statement:Click on the Go Back link.
    • "User USERNAME was added to the database DATABASE."
  3. You should now see the user you created in Step 5 above in the "Users" column.

Back to top


7. How do I delete a MySQL database?

Overview

You can easily delete a MySQL database from your web hosting account. Follow the instructions below.

Steps

  1. When the page loads, you will see a table containing the following information, split into five columns:Next, find the database you want to delete in the "Database" column.
    • Database - This entry will be the database name you created in Step 1 above.
    • Size - This entry will be the size of the database you created in Step 1 above.
    • Users - This entry will be the users in the database.
    • Actions - You have once choice:
      • Delete Database - Click on this link to delete a database.
  2. Then click on the Delete Database in the "Actions" column.
  3. You will see the following confirmation statement:Click on the Yes button.
    • "Are you sure you wish to permanently remove the DATABASE_NAME?"
  4. You will see the following statement:
    • "Deleted the database DATABASE_NAME."
    • "Database "DATABASE" dropped."

Back to top


8. How do I repair a MySQL database?

Overview

You can repair your MySQL database by using the "Repair DB" feature in cPanel.

Steps

  1. Select the database you want to repair from the "Repair DB" drop down menu.
  2. Click on the Repair DB button.

Back to top


9. How do I setup remote access to my MySQL databases?

Overview

Remote MySQL allows external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site.

NOTE: "localhost" stands for the server that your site is currently on.

Steps

  1. Enter a server's host name or IP address in the "Host (% wildcard is allowed)" text box.
  2. Click on the Add Host button.
  3. You will see the following statement:Click on the Go Back link.
    • "Added Host HOSTNAME to the access list."
  4. When the page loads, you will see a two-column table containing the following information:
    • Access Hosts - This entry will include the host name or IP address.
    • Remove - Click on the x in a circle icon to remove the "Access Hosts" from being allowed to access your MySQL database.

Back to top


10. How do I use phpMyAdmin?

Overview

phpMyAdmin is a web based database administration tool specifically for managing MySQL databases. Once you click on the phpMyAdmin link on the cPanel dashboard, phpMyAdmin will automatically load in a new window.

First select the database you want to manage from the "Database" drop down menu. Then you can begin using all the functions and features phpMyAdmin has to offer in this advanced, yet easy to use web based database administration tool.

To learn about how to use all of the phpMyAdmin features visit phpMyAdmin.

Back to top


11. How do I connect to a MySQL database through Perl?

Use the following outline to connect and query the MySQL server from a Perl script.

1. 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;

2. 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.

Mysql->connect('localhost','DATABASENAME','USERNAME','USERPASSWORD');

3. Executing A Query

You are now ready to begin querying the database server. Most problems that you may incur will generally occur due to syntax errors.

For a video tutorial about accessing your MySQL database through Perl, please go to How to connect to MySQL database using Perl.

Back to top


welcome | name | hosting | design | content | promote | update | showcase | support | general information

Showcase Update Promote Content design Hosting Name Welcome