MySQL is one of the world’s most popular relational database management systems and has also become very popular with the spread of PHP. Most of the PHP scripts you use every day on any website is using a MySQL database system in the background. MySQL is ideal for storing and accessing data in a database. In this database, for example, user data of the registry are stored, comments and contributions from forums, or the articles in a webshop.
The learning curve of MySQL is very high, so you can quickly write your applications using a MySQL database in the background. In our PHP tutorial, you have learned how to handle files, how to save values in them. It’s a good idea to switch to the database rather than files, because finding new values, searching for existing entries, and deleting specific rows from a database is much easier than doing the same thing with text files.
In this tutorial, you will learn the basics of MySQL and how to access a MySQL database with PHP. Our tutorial is structured as follows:
Installing and Starting MySQL
In the first part, you will learn how to install and start a MySQL server. Also, the explanation of the basic concepts.
For database management, it is recommended to use the phpMyAdmin software. This tutorial introduces you to the basics.
Build a database connection
This tutorial as title explained, utilizing PHP and PDO may be established a connection to the MySQL database.
Simple data query via SELECT
This article describes the SQL SELECT command for querying data from a table.
More complex data query with SELECT
Further possibilities with SELECT to get specific data records from a table. The article shows the use of WHERE, ORDER BY, and LIMIT.
Prepared statements allow parameters to be embedded in SQL query. It provides additional protection against SQL injections.
Inserting data via INSERT
This tutorial covers various ways to add new records to a table.
Updating Data by using UPDATE
This article explains the UPDATE command for updating records.
Deleting data using DELETE
This article explains the DELETE command for deleting records.
Entries count by COUNT
This article explains the SQL COUNT command and how to determine the number of records found.
DATE database columns
This article provides tips on how to efficiently save the time and date in the database and which of the possible variants is best.
Date and Time
Functions in MySQL has many features to work with date and time fields.
MySQL Error Messages
Does SQL Query not do what it should and returns an error message? Here are a few tips for understanding the error messages.
Database Connection Close
The article explains the closing of the connection to the database.
MySQL LEFT Join
Using JOIN, two or more tables in SQL can be queried, and their results merged.
Optimizing MySQL: Using the Index
Indexes can be defined in MySQL using INDEX, UNIQUE and PRIMARY KEY. These speed up the search for data.
MySQL Normal Forms
The three normal forms help you to get a better design of your database.
MySQL Foreign Keys
Use foreign keys to ensure relationships between two tables in MySQL. If values have changed in one table or entries are deleted, this is taken directly into the second table.
Overview SQL Commands
A compact overview of all essential SQL commands.
Crash Course on MySQL
Crash Course on Outdated MySQL Interface.
Crash Course on MySQLi
Crash course to MySQLi interface.
Crash Course on PDO
Crash Course to the PHP Data Objects (PDO).