Cara menggunakan mysql sample database github

Lompati ke konten utama

Browser ini sudah tidak didukung.

Mutakhirkan ke Microsoft Edge untuk memanfaatkan fitur, pembaruan keamanan, dan dukungan teknis terkini.

Unduh Microsoft Edge Info selengkapnya

Baca dalam bahasa Inggris

Baca dalam bahasa Inggris

Menyebarkan database dari GitHub ke Azure

  • Artikel
  • 09/22/2022
  • 2 menit untuk membaca

Dalam artikel ini

Artikel berikut memberikan dukungan untuk menyebarkan pembaruan database dari GitHub ke Azure. Anda dapat menggunakan GitHub Actions untuk disebarkan ke Azure SQL, Azure MySQL, dan Azure Database for PostgreSQL.

  • Menggunakan Tindakan GitHub untuk menghubungkan ke Azure SQL Database
  • Gunakan GitHub Actions untuk membuat sambungan ke Azure MySQL
  • Gunakan GitHub Actions untuk membuat sambungan ke Azure PostgreSQL

Dalam artikel ini


With PHP, you can connect to and manipulate databases.

MySQL is the most popular database system used with PHP.


What is MySQL?

  • 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

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

PHP + MySQL Database System

  • PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

Database Queries

A query is a question or a request.

We can query a database for specific information and have a recordset returned.

Look at the following query (using standard SQL):

SELECT LastName FROM Employees

The query above selects all the data in the "LastName" column from the "Employees" table.

To learn more about SQL, please visit our SQL tutorial.


Download MySQL Database

If you don't have a PHP server with a MySQL Database, you can download it for free here: http://www.mysql.com


Facts About MySQL Database

MySQL is the de-facto standard database system for web sites with HUGE volumes of both data and end-users (like Facebook, Twitter, and Wikipedia).

Another great thing about MySQL is that it can be scaled down to support embedded database applications.

Look at http://www.mysql.com/customers/ for an overview of companies using MySQL.



The Sakila sample database is available from https://dev.mysql.com/doc/index-other.html. A downloadable archive is available in compressed tar file or Zip format. The archive contains three files: sakila-schema.sql, sakila-data.sql, and sakila.mwb.

Note

Sakila contains MySQL version specific comments, in that the sakila schema and data depends on the version of your MySQL server. For example, MySQL server 5.7.5 added support for spatial data indexing to InnoDB, so the address table will include a spatial-aware location column for MySQL 5.7.5 and higher.

The sakila-schema.sql file contains all the CREATE statements required to create the structure of the Sakila database including tables, views, stored procedures, and triggers.

The sakila-data.sql file contains the INSERT statements required to populate the structure created by the sakila-schema.sql file, along with definitions for triggers that must be created after the initial data load.

The sakila.mwb file is a MySQL Workbench data model that you can open within MySQL Workbench to examine the database structure. For more information, see MySQL Workbench.

To install the Sakila sample database, follow these steps:

  1. Extract the installation archive to a temporary location such as C:\temp\ or /tmp/. When you unpack the archive, it creates a directory named sakila-db that contains the sakila-schema.sql and sakila-data.sql files.

  2. Connect to the MySQL server using the mysql command-line client with the following command:

    $> mysql -u root -p

    Enter your password when prompted. A non-root account can be used, provided that the account has privileges to create new databases.

  3. Execute the sakila-schema.sql script to create the database structure, and execute the sakila-data.sql script to populate the database structure, by using the following commands:

    mysql> SOURCE C:/temp/sakila-db/sakila-schema.sql;
    mysql> SOURCE C:/temp/sakila-db/sakila-data.sql;

    Replace the paths to the sakila-schema.sql and sakila-data.sql files with the actual paths on your system.

    Note

    On Windows, use slashes rather than backslashes when executing the SOURCE command.

  4. Confirm that the sample database is installed correctly. Execute the following statements. You should see output similar to that shown here.

    mysql> USE sakila;
    Database changed
    
    mysql> SHOW FULL TABLES;
    +----------------------------+------------+
    | Tables_in_sakila           | Table_type |
    +----------------------------+------------+
    | actor                      | BASE TABLE |
    | actor_info                 | VIEW       |
    | address                    | BASE TABLE |
    | category                   | BASE TABLE |
    | city                       | BASE TABLE |
    | country                    | BASE TABLE |
    | customer                   | BASE TABLE |
    | customer_list              | VIEW       |
    | film                       | BASE TABLE |
    | film_actor                 | BASE TABLE |
    | film_category              | BASE TABLE |
    | film_list                  | VIEW       |
    | film_text                  | BASE TABLE |
    | inventory                  | BASE TABLE |
    | language                   | BASE TABLE |
    | nicer_but_slower_film_list | VIEW       |
    | payment                    | BASE TABLE |
    | rental                     | BASE TABLE |
    | sales_by_film_category     | VIEW       |
    | sales_by_store             | VIEW       |
    | staff                      | BASE TABLE |
    | staff_list                 | VIEW       |
    | store                      | BASE TABLE |
    +----------------------------+------------+
    23 rows in set (0.01 sec)
    
    mysql> SELECT COUNT(*) FROM film;
    +----------+
    | COUNT(*) |
    +----------+
    |     1000 |
    +----------+
    1 row in set (0.00 sec)
    
    mysql> SELECT COUNT(*) FROM film_text;
    +----------+
    | COUNT(*) |
    +----------+
    |     1000 |
    +----------+
    1 row in set (0.00 sec)