Placeholder

Introduction to MySQL

 

What is MySQL?

MySQL is “The world’s most popular open source database.” MySQL is popular among the PHP community as it provides high performance, reliablity, and is very easy to use. Sites like Facebook and Google utilize the capabilities of MySQL. MySQL is not the only type of database that PHP works with. PHP also works with Oracle (and others). Oracle is usually found on enterprise levels as licensing costs can get pretty pricey. If you develop on your own computer, or even most hosting sites will have a WAMP or LAMP setup. This means Windows Apache MySQL PHP or Linux Apache MySQL PHP. MySQL runs on over 20 platforms including Windows, Linux, and Mac.

What is a database?

A database is a place where you can store data securely, and idealy. There are other ways to store data, but the most beneficial is a database. Databases will have have tables, where you can organize your data in there. Each table will have columns and rows. Columns are the things you want to store, and the rows are the data. (Just like a normal table). Databases do require structure, and must be secured. When you store data in a database, you must have all identifying items one-way encrypted. MySQL won’t force you to, but as a developer, you should encrypt data such as passwords. We’ll talk more about what needs to be encrypted, and what needs to be altered for smooth databse operations.
MySQL is known as a Relational database. A relational database is what I described above, with tables, and columns. There are other kinds of databases if you would like to research on your own time. I find it more knowledge than applicable.

Administration of databases

DBA

One important thing with databases is there needs to be an administrator. This person usually structures the database, and makes sure everything runs smooth. Most of the time, this is the responsibility of the web developer – but some companies will hire Database Administrator (DBA). These tasks can be time consuming in a company as if you are the only DBA, and an application goes down in the middle of the night – You have to get up and fix it. Small applications usually don’t have DBA’s or DBA’s that work stressful hours – but DBA’s do get their share on payday!

Tools

If you do a quick google search for “MySQL admin tools”, you’ll find quite a few options.

  • PHPMyAdmin
  • Navicat
  • SQLBuddy

PHPMyAdmin is my personal favorite one. Be careful of ones that say they’ll build a query for you. Computer logic never exceeds human logic. It can only match the logic of its developer. PHPMyAdmin is a free tool, and I will be using it for these tutorials. If you prefer another one that is okay. You can also maintain databases via command line. I will not be covering any commands needed to create or execute queries.

Why use databases?

I hope you can answer this question. If not, I’ll help you. As of now, your content is known as static. It doesn’t change unless you edit it. It is ‘hard-coded’ in your script. That just won’t do for us. You’re tired of editing pages to meet updates. Databases store content – content your site can read from. Let’s say you want to make a blog, or a mailing list, or even a usersystem – you need to store that information somewhere. A database driven website is often known as dynamic. A dynamic site is changeable by the content it grabs from. Storing information in databases can also provide you access to run reports on sales, or visitors, or percentage of visitors to registrations. Databases are convienent.

 

Related Posts

Placeholder

SQL Syntax and Creating a Table

Placeholder

Setting Up Your Database

Leave a Reply









Recent Tweets

Follow Me On Twitter →

Email Updates

Sign-up below to receive weekly updates to DevTuts posts. These emails not only include a recap of the week, but also sometimes freebies just for our email subscribers.