Step Amazon AWS EC2 instance step by step guidence Command
Step 1 New instance created on amezon AWS. OS: UBUNTU 12.04 SERVER, 2 Core 12 GB HDD and 7.5 GB RAM
Step 2 Installing PHP sudo apt-get install php5-mysql
Step 3 Installing Mysql sudo apt-get install mysql-server
Setted root password: PK@admin$9
Testing Sale: pk@admin$9 root mysql password
Step 4 Installing mysql-php client sudo apt-get install mysql-server mysql-client
Step 5 Installing Apache2 sudo apt-get install apache2
Step 6 Installing php apache library sudo apt-get install php5 libapache2-mod-php5
Step 7 Restarted Apache server sudo /etc/init.d/apache2 restart
Step 8 Check mysql is running or not sudo netstat -tap | grep mysql
Step 9 connected to mysql Server mysql -uroot -p
Checking of the uses select Host, User, Password, Grant_priv from mysql.user;
New database creation create database sq_offers;
New user created
Granted all privileges to new user grant all privileges on *.* to ‘pksqueak’@’localhost’ identified by ‘pk@admin$9′;
Granted all privileges to new user grant all privileges on *.* to ‘pksqueak’@’%’ identified by ‘pk@admin$9′;
Step 10 Connection binding for mysql sudo vim /etc/mysql/my.cnf
bind-address =
to (to allow to connect through Navicate or some other tools)
Bind-address =
and restarted the mysqld server using “sudo /etc/init.d/mysql restart” command
Step 11 Connected to Navicat using new created mysql user and password
Step 12 Install curl sudo apt-get install php-http make
sudo pecl install pecl_http
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
Step 13 edit PHP.ini file sudo vim /etc/php5/apache2/php.ini
Add extension to php.ini file
Dynamic Extensions ;
Step 14 Restart Apache sudo /etc/init.d/apache2 restart
Step 15 Mod rewrite enable sudo a2enmod rewrite
Step 16 Installing xdebug in linux – ubuntu sudo apt-get install php5-dev php-pear
sudo pecl install xdebug
sudo aptitude install php5-xdebug
Step 17 Installation of GD Library sudo apt-get install php5-gd
Checking of GD library is installed or not php5 -m | grep -i gd
Enable mod_headers sudo a2enmod headers
Enable mod_expires sudo a2enmod expires
Enable mod_expires and mod_headers PHP code: this should be added into all page
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 2003 05:00:00 GMT");

HTACCESS File contect: This should be added into .htaccess file
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 1 month"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"

Full Text enabling in mysql sudo vim /etc/mysql/my.cnf and set the value of “ft_min_word_len=3” as per requirement
ENABLING DEFLATE AND GZIP: sudo a2enmod deflate
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
DeflateCompressionLevel 9
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html
RewriteEngine on
AddType text/html .shtml
# image will remain same
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI
.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
<IfModule prefork.c>
<IfModule !mod_ruid2.c>
We can access MySQL server by using: mysql -u root -p
GRANT PRIVILEGES: mysql> GRANT ALL ON databasename.* TO personsname@localhost IDENTIFIED BY ‘Add-Your-Password-Here';
FLUSH PRIVILEGES; mysql> GRANT ALL ON databasename.* TO personsname@ IDENTIFIED BY ‘Add-Your-Password-Here';
mysql> show databases;

mysql> create database XXX;
MCRYPT INSTALLATION: sudo apt-get install php5-mcrypt
ENABLE MCRYPT sudo php5enmod mcrypt
Enabling error reporting display_errors
Default Value: On
; Development Value: On
; Production Value: Off
; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off

Default Value: E_ALL & ~E_NOTICE

Granting privileges to ip or user GRANT ALL PRIVILEGES ON *.* TO ‘pksqueak’@’%';
Grant all privileges on *.* to ‘himanshu’@’%’ identified by ”;

4 Responses to AWS-Installation

  1. Mysql user says:

    CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';



  2. Mysql user says:

    How to Create a New User

    In Part 1 of the MySQL Tutorial, we did all of the editing in MySQL as the root user, with full access to all of the databases. However, in the cases where more restrictions may be required, there are ways to create users with custom permissions.

    Let’s start by making a new user within the MySQL shell:

    CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

    Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell.

    Therefore, the first thing to do is to provide the user with access to the information they will need.

    GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

    The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.

    Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges.


    Your changes will now be in effect.


    How To Grant Different User Permissions

    Here is a short list of other common possible permissions that users can enjoy.

    ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)

    CREATE- allows them to create new tables or databases

    DROP- allows them to them to delete tables or databases

    DELETE- allows them to delete rows from tables

    INSERT- allows them to insert rows into tables

    SELECT- allows them to use the Select command to read through databases

    UPDATE- allow them to update table rows

    GRANT OPTION- allows them to grant or remove other users' privileges

    To provide a specific user with a permission, you can use this framework:

    GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;

    If you want to give them access to any database or to any table, make sure to put an asterisk (*) in the place of the database name or table name.

    Each time you update or change a permission be sure to use the Flush Privileges command.

    If you need to revoke a permission, the structure is almost identical to granting it:

    REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’;

    Just as you can delete databases with DROP, you can use DROP to delete a user altogether:

    DROP USER ‘demo’@‘localhost’;

    To test out your new user, log out by typing


    and log back in with this command in terminal:

    mysql -u [username]-p

  3. AWS Guru says:


    While it's possible to do, it is not recommended.


    To actually enable root logins first you have to set a password for the root account and then unlock the locked root account. If you don't set a password for the root account the passwd command will return

    passwd: unlocking the password would result in a passwordless account.

    So, first execute in a terminal

    sudo passwd root

    you will be prompted for a new Unix password. Write it twice (second for confirmation).

    Then execute

    sudo passwd -u root

    to unlock the account. This should return

    passwd: password expiry information changed

    Reverting back

    If you want to disable root account in Ubuntu you need to lock the root account by using the following command sudo passwd -l root

    Alternatives to root login

    If you want to work on a root console you can also use sudo -i.

    Only do this if you know what you are doing. More information on why to stay with sudo here

    Graphical version needs setting up 1st:

    pkexec gnome-terminal will open a terminal with a root prompt.

    passwd root will allow you to create a password for root.

    Note: Running users-admin with elevated privileges no longer works because of a bug that is marked as "Won't Fix" for security reasons. See for an explanation.

  4. Praful Kumar says:

    select Host, User, password_expired, password_last_changed, password_lifetime, authentication_string  from mysql.user;

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>