職案人

求職・歴史・仏教などについて掲載するつもりだが、自分の思いつきが多いブログだよ。適当に付き合って下さい。

mysqlの設定

2015年08月28日 | xampp
mysqlの設定


■MySQLのパスの設定
Windowシステムの「環境変数」を開いて、Path変数を編集する。
編集値に「C:\xampp\mysql\bin;」を入力する。

■MySQLの起動と終了
①xamppのコントロールパネルのMySQLのstartボタンをクリックする。
②「管理者として実行する」からコマンドプロンプトを立ち上げる。
C:\Windows\system32>net start mysqlとコマンド打ち込む
③「管理者として実行する」から、xamppのコントロールパネルを立ち上げ、Serviceの☓印をクリックする。
そして、サービスから起動する事が出来る。
④終了
C:\Windows\system32>net stop mysql
コントロールパネルのstopボタンを押すか、サービスの停止ボタンを押す

■MySQLのセキュリティ
①xamppの管理ページ(http://localhost/xampp/)を立ち上げ、セキュリティをクリックする。
②xamppセキュリティページが開く。
③「http://localhost/security/xamppsecurity.php」をクリック
④MySQLのセキュリティコンソール&xamppのディレクトリ制御が表示される
そこで、パスを設定したら、「パスワードを変更しました」ボタンをクリック
以上で、パス設定完了

■接続
コマンドプロンプト
c:\xampp\mysql>cd C:\xampp\mysql\bin

C:\xampp\mysql\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.20 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>\q
Bye
C:\xampp\mysql\bin>exit
コマンドプロンプトが閉じる。

■my.iniの設定
シフトJISにするには
[client]
default-character-set=utf8

[mysqld]
## UTF 8 Settings
init-connect=\'SET NAMES utf8\'
collation_server=utf8_unicode_ci
character_set_server = utf8
skip-character-set-client-handshake
character_sets-dir="C:/xampp/mysql/share/charsets"

[mysqldump]
default-character-set=utf8

[mysql]
default-character-set=utf8

■確認
mysql> status
--------------
mysql Ver 14.14 Distrib 5.6.20, for Win32 (x86)

Connection id: 7
Current database:
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.6.20 MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 24 min 33 sec

Threads: 1 Questions: 68 Slow queries: 0 Opens: 78 Flush tables: 1 Open tab
les: 71 Queries per second avg: 0.046
--------------
mysql> show variables like 'char%';
+--------------------------+--------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | C:\xampp\mysql\share\charsets\ |
+--------------------------+--------------------------------+
8 rows in set (0.00 sec)

■試験的にデータベースを作る。
・phpMyAdminにログイン
ブラウザから「http://localhost/phpmyadmin/」を入れるか?xamppのコントロールパネル、MySQLの行にある「Admin」ボタンをクリック
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

サンプルコードを使ったPHP動作確認

2015年08月28日 | xampp
「sample.php」

・【sample.php】
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>PHPテスト</title>
</head>
<body>

<h1>PHPのテストです</h1>

<p>
今日の日付は
<?php
echo date('Y年m月d日');
?>
です。
</p>

</body>
</html>
結果
PHPのテストです

今日の日付は 2015・08月28日です。

コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

Apacheのhttp.confファイル

2015年08月28日 | xampp
Apacheのhttp.confファイル設定


■「httpd-xampp.conf」ファイル
・PHPINIDir
PHPの設定ファイルである php.ini ファイルが設置されているディレクトリを指定。
<IfModule php5_module>
PHPINIDir "C:/xampp/php"
</IfModule>

.LoadModule
Apache用のPHPモジュールを読み込んでいます。
LoadFile "C:/xampp/php/php5ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php5_module "C:/xampp/php/php5apache2_4.dll"

・拡張子に関する設定
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
<FilesMatch ".php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
以上
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする