Tag Archives: mysql

When Do We Need MySQL Databases With Our Web Hosting?

Whenever you buy web hosting, your hosting provider is sure to include an option called “Databases” in his price quotation or package details. But not many of us know what are databases and why we need them when setting up a website. This article aims to explain a couple of reasons why we use databases and when we need them for our website.

The database systems we usually get with our web hosting accounts are all relational database systems or RDBMS. If we take a Windows hosting server we usually get Microsoft SQL aka MSSQL and if we take a Unix based system we usually get MySQL. Both these systems put your website data into tabular layouts for fast and easy retrieval.

Databases are a collection of rows and columns, where each row or column is related to the others in some way. Due to this relation, information from this database can be retrieved quickly and efficiently as compared to if the data was stored in any other unstructured format. You can consider a database as a collection of multiple spreadsheets which are all related to each other in some way or the other.

Security

A major advantage of having your data stored in a database is the ability to protect the database from unauthorized access, or the ability to protect a database record from being tampered with. A simple example would be the storage of login credentials. In a simple way, login credentials can be stored in a simple text file and be read by your script which does the authentication. However, your file will always save the password stored in plan text, making it vulnerable to anyone who has access to it. Databases have the ability to encrypt the entries using a hashing algorithm to obscure them. Further, to read or write to the database, you need to specify login details, something which is not easily possible with an ordinary text file or spreadsheet.

Efficiency

Due to the manner in which data is stored in the database, retrieval and storage is most efficient. Unlike a spreadsheet, where anything and everything can be stored in any cell, SQL restricts the type of information stored in each row or column based on certain conditions. This validation is inherent in the properties of SQL and is an added advantage for a programmer or developer. Due to the various inbuilt mechanisms that are present in RDBMS systems, they are the most preferred method of storage and retrieval of data.

An article on the DatabaseJournal Blog explains this in a lucid way:

“…The problem with text files is during a read, if the text file is large, it can take quite a bite of time to open and scan the contents of the file looking for what we want. Also, if we wanted to see all the sales to a specific customer, the entire text file would have to be read, and every line occurrence of the customer name would need to be saved in some temporary place until we had them all. If we saved to a spreadsheet instead of a text file, we would have a Sort feature built in. So we may be able to find all the sales to a specific customer quicker, but again, if the file was large, opening the spreadsheet could take a great deal of time.”

Administrative Control

Database systems also have various control mechanisms which allow easy administration of the database and tables within it. The most important part is user management. Each user can be given specific rights to the database, thereby allowing limitation in access so as to secure the data from being tampered, modified or altered. Database Administrator’s can tweak many settings of the database thereby restricting the flow of data, the connection speeds, maximum number of connections to the server and even adjust what hardware resources should be allocated for performing a task.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near … at line …

This error is often encountered on PHP MySQL content management systems when updating data or filling out a form for submission. It is also seen in WordPress, Drupal, Joomla installations which have broken themes or plugins.

Possible Causes

  • You have a broken software or application. You will need to contact your programmer or developer to fix the issue with the SQL statement in the application or form.
  • If you are using WordPress, Joomla, Drupal or any other CMS, this may be due to broken plugins or addons which you installed.
  • The SQL statement used by the programmer to add or update information to the database is incorrect or contains reserved (column) names.
  • You have entered special characters like ‘ ; ” , etc. which your application is unable to understand. Your software should have automatically detected this and corrected it. Consult with your software developer.
  • You are entering incorrect values into the form. Eg: Entering alphabets where only numbers are allowed.

This error is not related to the software or hardware on the server. It indicates an issue with the coding.

What are databases?

What are databases?

  1. Databases are programs that are built to store and manage information about people (names, addresses, etc.) or things (quantities, status, locations, etc.).
  2. A single database is made up of multiple tables, in which the data is grouped. It is like an Excel workbook, with multiple sheets inside.
  3. Databases streamline the entry, tracking, and reporting of data. Eg: Inventory management (stock, disposition, location, and transactions); sales (what was sold, who bought it, and for how much).
  4. Databases allow you to cross-reference different types of information. You can simultaneously put in date, time, alpha-numeric codes, etc. into a single database table.
  5. The databases in their raw form appear as a bunch of untabulated characters, hence not easily readable.

Database uses:

  1. With the help of database, we can increase consistency in our work by changing only a few values and keeping the skeleton format of the output the same. Eg: In a students report card, only the name, marks and grade of the student are different from other students report cards, the format of the report card remains the same.
  2. MySQL databases are required by many web applications including forum websites, billing softwares, content management systems and even your email clients.
  3. Database helps us in reducing data entry, storage, and retrieval cost by streamlining the data into various fields and retrieving the exact data required.

Examples of database softwares: Oracle, Microsoft access, MySQL.