maple

MySQLでデータベースを作成しながらW3Schools.comで学習

MySQL 8.0

MySQLのダウンロード

2018年8月現在、インター生相手の家庭教師を始める15年以上前に、わたしはコンピュータ業界で働いていました。会社の事業は、生産管理、在庫管理などのコンピュータシステムの開発でした。

その時にお客さんとなる企業の生産管理の担当者の方から、データベースのことでよく質問されました。簡単に言うと、データベースの作成に使われる、SQLというコンピュータ言語を自分なりに勉強を試みたのだが、さっぱり分からなかったということでした。

理系の技術者の方々は、技術知識の習得に熱心な人が多いのですが、畑違いの専門分野のコンピュータ言語やデータベースの概念を、基礎知識なしに理解しようとするのは、難しいことだと思います。

しかしながら、ITの仕事の中でも、データベースの入力、編集、インポートという作業は、面倒なことなのですが、要領さえつかんでしまえば、技術的にはさほどハードルは高くありません。また、案件も多く、仕事量も多いので、お金を稼ぐのに、もってこいの仕事です。

そこで、今回改めて、データベースを自分で作成してみたい方のために、個人または非営利目的なら無料で使える、MySQLという便利なデータベースソフトのダウンロード方法と使用法を具体的に説明していきます。

MySQLでデータベースを作成しながらW3Schools.comで学習の目次

興味のあるコース、または、項目をクリックしてください。そこへジャンプします。

ネット上の優れた無料のMySQLの解説を利用してダウンロード
少し難しく面倒なMySQLのインストール
MySQLが適切にインストールされたかどうかの確認
my.iniというファイルの所在の確認とパスの通し
Northwindmysqlのサンプルデータベースのダウンロード、及びインポート

ネット上の優れた無料のMySQLの解説を利用してダウンロード

多くある中でも、DBOnlineのサイトの説明が非常に丁寧で分かりやすいのですが、このサイトをアップデートされた2018年5月時のバージョンは、MySQL Community Server 8.0.11でした。

しかし、8月現在では、MySQL Community Server 8.0.12となり、インターネット上の表示が若干変更になっています。インストールに慣れていない方は、ダウンロードの時点で、つまづいてしまう人も多いので、説明と注意点を加筆します。

日本語と混載すると非常に見づらく、わたしの生徒たちのインター生の方々は、英語の表記に問題がないので、簡単な英語でのメモの走り書きで説明していきます。

上記のサイトにアクセスして、指示通りにダウンロードしていきます。情報工学(IT)という分野では、英語での表記に慣れてください。日本語にこだわると、面倒なことが多いです。

Download > MySQL Community Edition (GPL) Community (GPL) Downloads > MySQL Community Server (GPL) Download

All figures are the same as shown on the website above.

However, MySQL Community Server 8.0.11 is replaced with the newer version of Server 8.0.12.

Confirm that the operating system is Microsoft Windows.

Go to Download Page > MySQL Installer 8.9.12 Windows (x86, 32-bit), MSI Installer (mysql-installer-community-8.0.12.0.msi) Download > No thanks, just start my download.

As downloading is completed, start installing.

目次のトップへ

少し難しく面倒なMySQLのインストール

MySQL Installer

バージョンが更新されると、表示が変わり、インストールに慣れていない人は、困惑してしまうことが多いので、2018年8月現在において、MySQL Community Server 8.0.12の場合のインストールの手順を説明します。

わたしが実際にインストールした際には、Check Requirementsにおいて、Visual Studio version 2017 (or 2012, 2013)のダウンロードが必要になったので、かなりの時間を必要としました。また、Choosing a Setup Typeにおいては、Developer Defaultを選択しました。

それから、二度目のProduct Configurationの次に、MySQL Router Configuration、Connect to Server、二度目のApply Configuration、そして、最後にInstallation Completeとなりました。上記のサイトによるインストールと若干異なりますが、基本的には、Nextをクリックで間違いはないと思います。

1. Open MySQL foleder installed in the Downlaods folder.

2. Check on □ I accept the license terms on License Agreement, and Press Next.

3. Choosing a Setup type ○ Developer Default.

Choosing a Setup Type - Developer Default

4. Select Products and features

Select Products and features

Just click Next. In case features don't show up, click on an arrow in the middle.

5. Check Requirements

Check Requirements

6. As Visual Studio version 2017 is required to be installed, start downloading it, and ignore Python 3.6 (64-bit).

7. Move to Visual Studio Downloads, select Visual Studio Community 2017and download it.

Visual Studio Downloads

8. Visual Studio Installer will appear after a while. Check on Universal Windows Platform development, .NET desktop development, and Desktop Development with C++, download them. It may take a while.

Visual Studio Installer

9. Skip downloading Python as it is not required for MySQL database development this time.

10. Installation

Installation

Click Execute.

11. Product Configuration

Product Configuration

Click Next.

12. Group Replication

Group Replication

Click Next.

13. Type and Networking

Type and Networking

Click Next.

14. Authentification Method

Authentification Method

Click Next.

15. Accounts and Roles

Accounts and Roles

Type a password and click Next.

16. Windows Service

Windows Service

Click Next.

17. Apply Configuration

Apply Configuration

Click Execute.

18. Product Configuration (2)

Product Configuration 2

Click Next.

19. MySQL Router Configuration

MySQL Router Configuration

Click Finish.

20. Connect to Server

Connect to Server

Click Next.

21. Apply Configuration (2)

Click Execute.

22. Installation Complete

Installation Complete

Click Finish.

目次のトップへ

MySQLが適切にインストールされたかどうかの確認

最後に次の手順で、MySQLが適切にインストールされたかどうか、確認してください。

1. Make sure if MySQL is properly installed through Computer Management.

1-1. Right click the Start menu.

1-2. Click Computer Management.

Computer Management

1-3. Click Services and Applications.

1-4. Click Services.

Computer Management - Services

1-5. Scroll down until MySQL appears. If you can see it running, MySQL installation is successful.

目次のトップへ

my.iniというファイルの所在の確認とパスの通し

1. Find the location of "my.ini" file in MySQL
(MySQLのダウンロード後に、"my.ini" というファイルの所在を確認します。わたしのパソコンの場合、下記のディレクトリー内に収まっていました。)
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

2. Make MySQL to start and stop manually as a Windows Service
(ウィンドウズサービスでMYSQLの動作を手動に変更します。)
2-1. Right click on Start menu > Computer Management > Services and Applications > Services

2-2. Right click on MySQL80 > Properties > General > Startup type: manual

3. Change the Path in MySQL (パスの変更)

3-1. Environment variables > Path > C:\Program Files\MySQL\MySQL Server 8.0\bin

4. Connect to MySQL through MySQL Command Line Client (- Unicode)
(MySQL コマンドラインクライアントによるMySQLへの接続)
4-1. Click on Start menu > MySQL > MySQL 8.0 Command Line Client - Unicode

4-2. Enter password in the terminal

5. Connect to MySQL from the command line(コマンドプロンプトからMySQLへの接続)

5-1. Run command prompt as aministrator

5-2. Type "mysql -u root -p" and Enter password

目次のトップへ

Northwindmysqlのサンプルデータベースのダウンロード、及びインポート

1. How to import Northwindmysql sample databases for learning on W3Schools.com(Northwindmysqlのサンプルデータベースをダウンロード後にインポート)

1-1. Download northwindmysql sample databases to the right directory as shown below in the source

1-2. Type "create database northwindmysql;"

1-3. "use northwindmysql;"

1-4. "source C:\Program Files (x86)\MySQL\Samples and Examples 8.0\Sample Databases\Northwindmysql\northwindmysql.sql"

1-4. "show databases;"

1-5. "use northwindmysql;"

1-6. "show tables;"

1-7. "use customers;"

Now you are prepared to study SQL on W3Scholls.com.

上記のW3SchoolsのサイトでSQLを勉強する時に、実際にサンプルデータをMySQLのデータベースに取り込んで、体感しながら勉強できるようにしました。若干バージョンの違いはありますが、大きな問題にはならないと思います。

サイト上で使用されるNorthwindmysqlのサンプルデータベースをダウンロードしたディレクトリーの中のファイルの所在の確認を忘れないでください。ディレクトリーの記入を間違えるとインポートできなくなります。

MySQLを使えると、ウインドウズオフィスのデータベースソフト、アクセスのデータベースをインポートして取り込むこともできるので、データの管理がとても便利になります。商用の場合は、若干費用がかかることも忘れないでください。

慣れれば、それほどではないのですが、MySQLのダウンロードとインストール、Northwindmysqlのサンプルデータベースのダウンロードとインポートは、初めての方には、難しいかもしれません。

操作方法が分からない場合は、こちらまで電話やメールをいただければ対応します。独学で学びたい方も応援したいので、ボランティア活動の一環として、無料でお答えします。お気軽に連絡ください。


I am a disclaimer. The image rights of all the images above belong to Oracle Corporation and/or its affiliates.

トップへ

inserted by FC2 system