How to Install a MySQL Database using a MySQL Injection Script
- Date: 2007-01-22 - Word Count: 688
Share This!
Whenever you purchase or acquire a MySQL database (such as from a website like WebContents.org), chances are it will come as a MySQL injection script. An injection script is simply a SQL script that, when executed, creates the appropriate database tables and inserts the data using INSERT statements (one statement per record of data). Because of this, a SQL injection script is usually very large, but this is the easiest way to export and import a database so this is how it is usually done.
Once you have the injection script, installing it is usually very easy. Of course, you must already have MySQL Server (mysql.org) installed on your server, so if you haven't done that yet (such as if this is a new server), do it first, then put the script file in an easily accessible location (like the root folder of the server's main hard drive, usually drive C, or in the temp folder).
The process for installing a MySQL database using a MySQL injection script is fairly trivial, but there are a couple of snags you might run into along the way. The only way to find out if these apply to you, however, is to attempt to install the database using the script normally, and deal with exceptions as they occur. To execute the injection script, you first need to create a database to hold the data. Open a command prompt and type in the following command to start the MySQL command-line interface: "mysql -u root -p" (without the quotes). It will prompt you for the root password, then you will be logged into the MySQL instance.
To create the database, use the command "create database imported;" (without the quotes). Substitute the word imported for whatever database name you would like to use, and make sure you put in the semicolon at the end. If successful it should say "Query OK, 1 row affected". Now you are ready to run the injection script itself.
To execute the injection script, use the command "source c:tempvegrecipes.sql;" (without the quotes). Use whatever path and filename points to your injection script, and don't forget the semicolon at the end! It may take a while to run depending on how large the script is, but it should say "Query OK, 1 row affected" for each record that it inserts into the database.
That's it! The database should be installed, and you can find the data in whatever table is named at the beginning of the MySQL injection script (open it in notepad to see). The two most likely problems you might run into are unicode translation and script size. Depending on where you got the script, it may be formatted for a different Unicode set than your system normally uses -- if the script won't execute at all, open the script up in notepad and look for strange characters at the beginning of the file (delete them if you find any), then re-run the script. The other problem that might occur is if the injection script is VERY large -- your system may run out of memory or hang while it is trying to load/run the script. In this case, you might want to split the injection script into multiple files that can be executed in sequence. If you need to do this, you can use any program that will split a file BY LINE (not by characters or bytes because you don't want half a command to be in one file and the other half in the next), but a good one to use is SplitFile from rethinkit.com.
Now that you have the capability to install externally obtained MySQL databases using MySQL injection scripts, you may find that it is much easier to acquire databases this way rather than building them yourself from scratch. A good place to get MySQL injection script databases is www.WebContents.org. This is a great way to add large amounts of fresh content to your website, or even content that is not necessary but could be a nice additional feature for your website such as a joke or quote of the day, or food recipes, or rss feeds... the possibilites are endless!
Once you have the injection script, installing it is usually very easy. Of course, you must already have MySQL Server (mysql.org) installed on your server, so if you haven't done that yet (such as if this is a new server), do it first, then put the script file in an easily accessible location (like the root folder of the server's main hard drive, usually drive C, or in the temp folder).
The process for installing a MySQL database using a MySQL injection script is fairly trivial, but there are a couple of snags you might run into along the way. The only way to find out if these apply to you, however, is to attempt to install the database using the script normally, and deal with exceptions as they occur. To execute the injection script, you first need to create a database to hold the data. Open a command prompt and type in the following command to start the MySQL command-line interface: "mysql -u root -p" (without the quotes). It will prompt you for the root password, then you will be logged into the MySQL instance.
To create the database, use the command "create database imported;" (without the quotes). Substitute the word imported for whatever database name you would like to use, and make sure you put in the semicolon at the end. If successful it should say "Query OK, 1 row affected". Now you are ready to run the injection script itself.
To execute the injection script, use the command "source c:tempvegrecipes.sql;" (without the quotes). Use whatever path and filename points to your injection script, and don't forget the semicolon at the end! It may take a while to run depending on how large the script is, but it should say "Query OK, 1 row affected" for each record that it inserts into the database.
That's it! The database should be installed, and you can find the data in whatever table is named at the beginning of the MySQL injection script (open it in notepad to see). The two most likely problems you might run into are unicode translation and script size. Depending on where you got the script, it may be formatted for a different Unicode set than your system normally uses -- if the script won't execute at all, open the script up in notepad and look for strange characters at the beginning of the file (delete them if you find any), then re-run the script. The other problem that might occur is if the injection script is VERY large -- your system may run out of memory or hang while it is trying to load/run the script. In this case, you might want to split the injection script into multiple files that can be executed in sequence. If you need to do this, you can use any program that will split a file BY LINE (not by characters or bytes because you don't want half a command to be in one file and the other half in the next), but a good one to use is SplitFile from rethinkit.com.
Now that you have the capability to install externally obtained MySQL databases using MySQL injection scripts, you may find that it is much easier to acquire databases this way rather than building them yourself from scratch. A good place to get MySQL injection script databases is www.WebContents.org. This is a great way to add large amounts of fresh content to your website, or even content that is not necessary but could be a nice additional feature for your website such as a joke or quote of the day, or food recipes, or rss feeds... the possibilites are endless!
Related Tags: content, webmaster, server, resources, script, database, install, mysql, setup, injection, acquire, execute
Your Article Search Directory : Find in Articles
Recent articles in this category:
- How to Capitalize on Free Content From Podcasts
One of the major challenges for every website owner is generating compelling content that will - Looking for a Niche? 40 Keyword Suggestions
One of the most important steps foraffiliate marketing and Internet marketing is finding a go - 5 Benefits Of Having Your Own Home Business
There is no secret to why millions of people are flocking to the internet to start their own h - Optimized Articles Drive Traffic to Websites
Benefits of SEO ArticlesSEO Articles can help move websites up in the search engines and are o - Why You Should Be Using an Online Backup Service
Online BackupOnline backup services are relatively new but they are gaining popularity at the - FREEDOM1-PACKAGE.COM/ YOUR TOP MONEY ONLINE BUSINESSES Presents:
FREEDOM1-PACKAGE.COM/ YOUR TOP MONEY ONLINE BUSINESSES!Presents:Evaluating Your Website Traffi - 3 Bonuses To Success University's Already Stellar Program
It is not very often that you will come across a program to the likes of Success University. - How to Optimize Your Website For Better Visitor Experience and More Traffic
This article describes in simple terms, practical and effective tactics used to optimize your - Do You Like Being On Top? A Global Domains International Position.
If you like to be on top then you are just like millions of other web site owners trying to po - Internet Marketer's Dream: 8 Productivity Tips for Firefox Browser Users
Here are 8 productivity tips specifically for Mozilla Firefox users:1) SearchStatus. Set your
Most viewed articles in this category:
- The Webmaster's Assistant
There are many tools available to a webmaster to analyse website traffic allowing them to monitor th - Free Webmaster Resources
The overall importance of Quality Web Development or Web Design Tools is a factor among webmast - Webmaster Staff Leasing
Some of you might be wondering what webmaster staffing means? So just to make it clear for everyone - 6 Steps to a More Successful Website in 2006
Another year has passed and a new one has dawned. It's an exciting time to have an online business. - Web Analytics - Getting It Right
Understanding and using web analytics.In recent years, website marketers were concerned with increas - Want Your Website Visitors to Return?
If your like me you have searched on every search engine any possible way to advertise your website. - HTML Editors
If you're the typical non professional user then you are probably familiar with the more popular one - Easy Content Management with Server Side Includes (part 1)
I honestly see very few websites that can really say they don’t need some sort of Content Mana - 4 Nearly FREE Ways for a Web Designer to Establish a Local Presence
Everyone seems to be a web designer these days. From your uncle’s neighbor’s nephe - Reasons why you should have a Weblogger installed on your web site.
Radhika Venkata (c).I don't know about you, but when I built my first web site threeyears back I don