Introduction to Web programming 0731213
Lecture 1 Working with Database – PhpMyAdmin (1)
What is MySQL? MySQL is one of the most widely used relational database management system (RDBMS) and most widely used open-source RDBMS MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal for both small and large applications MySQL is very fast, reliable, and easy to use MySQL uses standard SQL MySQL compiles on a number of platforms MySQL is free to download and use MySQL is developed, distributed, and supported by Oracle Corporation MySQL is named after co-founder Monty Widenius's daughter: My
What is MySQL? The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows. Databases are useful for storing information categorically. A company may have a database with the following tables: Employees Products Customers Orders
What is MySQL? MySQL GUI Tools phpMyAdmin – Included in the LAMP stack, and MAMP, XAMPP and WAMP software bundle installers MySQL Workbench MYDB Studio Adminer Database Workbench DBEdit SQLyog HeidiSQL LibreOffice Base And more ….
What is PhpMyAdmin? PhpMyAdmin is one of the most popular applications for MySQL databases management. It is a free tool written in PHP. Through this software you can create, alter, drop, delete, import and export MySQL database tables. You can run MySQL queries, optimize, repair and check tables, change collation and execute other database management commands. We will use PhpMyAdmin to manage MySQL databases through it.
How to start with PhpMyAdmin Click on the MySQL administrative link in the XAMPP Control Panel.
PhpMyAdmin Administration Once you enter your PhpMyAdmin application, you will see different areas.
Databases In the Databases tab you will find a list with all the databases which can be managed through the cPanel user. Once you click on a chosen database, you can start its management.
Database Management The main functionality of the PhpMyAdmin tool is to manage your databases. Click on the Databases link. Pick the preferred database which you want to manage and click on its name.
Database Management In the new screen you will see a list with the database tables, the allowed actions with them, the number of the records, the storage engine, the collation, the tables' sizes and the overhead.
Lecture 2 Working with Database – PhpMyAdmin (2)
How to Create a MySQL Database? You can easily create a new database from your cPanel->MySQL Databases. Navigate to the Create New Database box. Enter the database name in the New Database text field and click on the Create Database button.
How to Add MySQL Database Tables? Navigate to your cPanel->PhpMyAdmin tool and open the newly create database. It is empty and there are no tables. Enter the table name and the number of fields. Click on the Go button to create the table.
How to Add MySQL Database Tables? On the next screen you should enter the fields' names and the corresponding properties. Some of the properties are: Type: Pick the type of the data, which will be stored in the corresponding field Length/Values: Enter the length of the field Null: Define whether the field value can be NULL Default: Allows you to set the default value for the field.
How to Add MySQL Database Tables? If you want to add more fields you should specify their number and click on the Go button instead of Save.
How to Add MySQL Database Tables? The database table will be created and you will see the corresponding MySQL query.
Database Management The possible actions which you can perform to a chosen table are: Browse Structure Search Insert Empty Drop And more ….
Browse Only the tables with existing records can be browsed. Once you click on the Browse icon a new window with the records list will be opened. By clicking on the Pen icon you can edit the chosen record. You will see the record structure and you can alter the values of the records.
Structure The next option is named Structure. In the Structure screen you will see the database's table structure. You will see the fields' names, their types, collations, attributes, additional extra information, the default values and whether the fields' values can be NULL.
Insert Using the Insert action you can insert records in your database table. Once you fill in the corresponding values click on the Go button and the new record will be inserted.
How to Backup a Database? In the Export section you can export your database tables content in different formats (CSV, SQL, PDF, Microsoft Excel, Microsoft Word, XML, and many more). You can select all the database tables or just pick some of them. You can decide whether to export just the database structure, the data or both of them.
How to Restore a Database Backup? You can import your database tables from a file, saved on your local computer.
Self Study How to run MySQL query with PhpMyAdmin (https://www.siteground.com/tutorials/phpmyadmin/phpmyadmin_mysql_query.htm) PhpMyAdmin Operations (https://www.siteground.com/tutorials/phpmyadmin/phpmyadmin_operations.htm) Repair and Optimize Database (https://www.siteground.com/tutorials/phpmyadmin/phpmyadmin_optimize_database. htm) Run MySQL Query (https://www.siteground.com/tutorials/phpmyadmin/phpmyadmin_mysql_query.htm)
References https://www.w3schools.com/ https://www.siteground.com/tutorials/phpmyadmin/ Robin Nixon, Learning PHP, MySQL, JavaScript, and CSS, 2013 Mike McGrath, PHP & My SQL in easy steps, 2012.
The End