さくらのレンタルサーバでMySQL + php = Facebookアプリ.#1
MySQL
さくらでサーバをレンタルする際に,スタンダード以上で申し込みをするとMySQLを使うことができる.
設定についてはここを読めばよい.
http://support.sakura.ad.jp/manual/rs/web/db_make.html
進めていくとphpMyAdiminという管理ツールでログインさせられそうになるが,今回はターミナルからMySQLを操作したい.
まずはターミナルからSSHでサーバにログインをしよう.
$ssh hoge@hoge.sakura.ne.jp(えんたー) hoge@hoge.sakura.ne.jp's password:(abcde12345)
するとWelcome to BSD!といって歓迎される.さらにここでMySQLを起動してみましょう.
上図に対応させると以下のようにすればよい.
mysql -h mysql***.db.sakura.ne.jp -u example -p(えんたー) Enter password: (************) Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2050230 Server version: 5.5.15-log Source distribution Copyright (c) 2000, 2011, 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>
これでMySQLが起動した.コマンドを入力することでデータベースを操作できるはずある.嬉しい.
実際の操作はまた次回にメモしよう.