Amazon ec2 使用幾個需要主要的地…

1:
啓動apache服務器:
sudo /etc/init.d/httpd start
命令:sudo chkconfig httpd on不行,不知道爲什麼


2:
用ec2-user登錄後,
首先超級用戶:
sudo su,因爲ec2-user是沒有root權限的


賦予 ec2-user 權限:這樣可以再winscp下設置文件
chown -R ec2-user:ec2-user /etc/httpd/conf/

3:
提示php沒有mysql extension
修改php.ini
extension=mysql.so



安裝phpmyadmin

1) First add the repository, then install:

首先避免亂碼:

LANG=C



不行的話多試幾次

This works fine on a standart 32bits amazon instance

2)once you have installed it, you must make a symbolic link (like a redirect) using 

sudo ln -s /usr/share/phpmyadmin /home/ec2-user/public_html

/home/ec2-user/public_html是改變後的目錄,這裏指向訪問的根目錄



 

配置文件現在需要絕密的短語密碼(blowfish_secret)。

園子在網上找了多種解決方法,寫的都不是非常詳細,嘗試了幾次後終於發現了最簡單的一種方法。

  1. 首先,把下載解壓的 phpMyAdmin 文件中有一個文件“config.sample.inc.php”,這是phpMyAdmin配置文件的樣本文件,我們需要把該文件複製,然後重命名爲“config.inc.php”,config.inc.php是phpMyAdmin的配置文件,上傳服務器時必須上傳該文件。
  2. 然後用 DW 或任意編輯器打開 config.inc.php 搜索下面一行代碼:
    $cfg['blowfish_secret'] = ”;
    將後面單引號裏面隨便填入個字符串即可!
  3. 修改完後,記得重起IIS 或Apache 。

其實,’blowfish_secret’用一個任意字符串作爲cookie的加密字符串,如果沒有加密鑰匙,就會出現提示“配置文件現在需要絕密的短語密碼(blowfish_secret)”。


提示沒有phpmyadmin的權限

linux查找文件:

cmd:find 查找路徑 -name 'name' -print

所以:find / -name phpmyadmin.conf

得到:/etc/httpd/conf.d/phpmyadmin.conf

 

Deny from all

Allow from 127.0.0.1

修改爲:

Allow from all


 

Existing configuration file (./config.inc.php) is not readable

安裝PHPMYADMIN時出現這個錯誤

Existing configuration file (./config.inc.php) is not readable

 

給config.inc.php   644   權限就可以了。


 

Installing MySQL on an EC2 Micro Instance

I’ve been doing a fair bit of work with Amazon EC2 instances recently, for my Final Year Project at uni. If you’ve not come across them before, then it’s basically Amazon’s way of making web-scale computing easy to set up and access. And it’s even more interesting when you see that they’re bringing in a free usage tier for the Linux Micro instances from 1st November this year.

When you create a new instance, you can choose an OS. If you choose “Basic Amazon Linux” (like I did) then you’ll get a stripped-down version that doesn’t have some bits you might be used to (like apt-get). I had to install MySQL recently, so here’s how to do that on such a setup:

sudo yum install mysql 
sudo yum install mysql-server 
sudo yum install mysql-devel 
sudo chgrp -R mysql /var/lib/mysql 
chmod -R 770 /var/lib/mysql 
sudo service mysqld start

By this stage, you’ll have MySQL installed and the service started. The next step is to set a password for the root user:

/usr/bin/mysqladmin -u root password yourpasswordhere

If you only want to use MySQL internally, then you’re all done now. But if you want to access MySQL externally then you’ll need to follow a few extra steps.

Firstly, go to the AWS Management Console, and find the Security Group that you assigned to your instance when you first set it up. Add “MySQL” to the group using the dropdown, or manually add port 3306. Save your changes.

Finally, create a MySQL user which is able to connect from any host (identified by a percent sign below) by running the following SQL using mysql from your instance’s command line:

mysql> CREATE USER 'myuser'@'localhost' IDENTIFIED BY 
    -> 'yourpasswordhere'
mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'localhost'
    -> WITH GRANT OPTION; 
mysql> CREATE USER 'myuser'@'%' IDENTIFIED BY 'yourpasswordhere'
mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'
    -> WITH GRANT OPTION;

And then you’re done, ready to connect from anywhere with that username and password.

發佈了55 篇原創文章 · 獲贊 4 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章