ラベル MariaDB の投稿を表示しています。 すべての投稿を表示
ラベル MariaDB の投稿を表示しています。 すべての投稿を表示

2017/04/02

Google Cloud Platform の無料トライアルをやってみる

Google Cloud Platform の無料トライアルの記録まとめ。

1.Google Cloud Platform 無料トライアル の利用規約要約

無料トライアルの利用規約、通常版とは異なる

Supplemental Terms and Conditions For Google Cloud Platform Free Trial | Google Cloud Platform Terms | Google Cloud Platform

Google Cloud Platform Free Trial

  • 無料トライアルの期間
    • 使用料が300ドルを超えた日
    • 無料トライアル開始日から12ヶ月を超えた日
  • 作成できるマシンのCPUコア数は最大8個まで制限
  • Bitcoinなどの仮想通貨のマイニングに使用してはならない
    • 通常版ではマイニングしても問題ないらしい
  • SLAは適応されない
    • クラウドサーバがダウンしたときの保証などのこと
  • 開始日から12ヶ月以内に通常版に移行すると、初期クレジット300ドルの残りクレジットがそのまま引き継がれる
    • ただしクレジットの有効期限は開始日から12ヶ月以内

2.登録とマシン作成

こちらのサイトを参考に作成
クレジットカードが必要
いつでも無料!Google Compute Engine 常時無料枠の使い方 | あぱーブログ


3.apache+php+mariaDBのインストール

yumコマンドでインストール
mariaDBはmysql互換のデータベースです

[CentOS 7] MariaDB Serverのインストールとsystemdによる操作

RHEL7からMySQLの代わりにMariaDBが提供されるようになりましたね。 MySQLと互換性があるようなので、これからはMariaDBの時代が来るのでしょうか。 また、SysV Initに代わってsystemdが新しいinitプロセスとして採用されました。

php

yum install php php-mysql

apache

yum install httpd
systemctl start httpd
systemctl senable httpd

mariadb

yum install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb

動作テスト
/var/www/html/にテスト用phpファイルを作成
cd /var/www/html/
vi index.php
<?php
    phpinfo();
?>

VMインスタンス→外部IPから「http://(IPアドレス)/index.htmp」アクセスして表示されればOK

2015/04/19

MariaDBでデータベースとテーブルの作成

MariaDBでデータベース、テーブル、ユーザの作成方法メモ

・MariaDBログイン

rootでログイン。「-u root」でログインユーザをrootに、「-p」でパスワード入力。
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

・データベース作成

データベース「exampleDB」を作成。
MariaDB [(none)]> create database exampleDB;
Query OK, 1 row affected (0.00 sec)

データベースが作成されているかを確認。
MariaDB [(none)]> MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| exampleDB          |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

・テーブルの作成

作成した「exampleDB」に移動してテーブル「exampleTable」を作成。
MariaDB [(none)]> use exampleDB
Database changed
MariaDB [exampleDB]> create table exampleTable(num int,name varchar(50));
Query OK, 0 rows affected (0.24 sec)

テーブルの確認
MariaDB [exampleDB]> show tables;
+---------------------+
| Tables_in_exampleDB |
+---------------------+
| exampleTable        |
+---------------------+
1 row in set (0.00 sec)

データ登録
MariaDB [exampleDB]> insert into exampleTable values(1,'aaa');
Query OK, 1 row affected (0.06 sec)

MariaDB [exampleDB]> insert into exampleTable values(2,'bbb');
Query OK, 1 row affected (0.07 sec)

MariaDB [exampleDB]> select * from exampleTable;
+------+------+
| num  | name |
+------+------+
|    1 | aaa  |
|    2 | bbb  |
+------+------+
2 rows in set (0.00 sec)

以上。

参考:
CentOS7 MariaDBのインストール