go to  ForumEasy.com   
JavaPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Amazon AWS » Install and configure MySQL on AWS EC2 instance
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: Install and configure MySQL on AWS EC2 instance
Linux
member
offline   
 
posts: 120
joined: 01/24/2011
from: San Jose, CA
  posted on: 10/26/2011 01:28:13 AM    Edit  |   Quote  |   Report 
Install and configure MySQL on AWS EC2 instance
Here’s how to do that:


$ sudo yum list | grep mysql*

$ 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


Now you’ll have MySQL installed and the service has started. The next step is to set a password for the root user:
$ usr/bin/mysqladmin -u root password secret


If you only want to use MySQL internally, then you’re all done now.

But if you access MySQL externally then you’ll get the error message similar like this:
SQL Error (1130): Host 'adsl-71-146-123-45.sbcglobal.net' is not allowed to connect to this MySQL server

 Profile | Reply Points Earned: 0
Linux
member
offline   
 
posts: 120
joined: 01/24/2011
from: San Jose, CA
  posted on: 10/26/2011 02:05:35 AM    Edit  |   Quote  |   Report 
How to enable remote access to MySQL?
Connect to mysql server:
$ mysql -u root -p secret


Create a new database called foo
mysql> CREATE DATABASE foo;


If you want database foo to be accessed by user bar from remote ipAddress 12.34.56.78, then you need to type the following command
mysql> GRANT ALL ON foo.* TO bar@'12.34.56.78' IDENTIFIED BY 'secret';

 Profile | Reply Points Earned: 0
Linux
member
offline   
 
posts: 120
joined: 01/24/2011
from: San Jose, CA
  posted on: 10/26/2011 02:11:30 AM    Edit  |   Quote  |   Report 
Grant and revoke remote root access to MySQL
To grant root access from all hosts (except for localhost):
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'secret';


To revoke root access from all hosts (except for localhost):
mysql> DELETE FROM mysql.user WHERE User = 'root' AND Host = '%';
mysql> FLUSH PRIVILEGES;
 Profile | Reply Points Earned: 0
Linux
member
offline   
 
posts: 120
joined: 01/24/2011
from: San Jose, CA
  posted on: 10/26/2011 02:16:27 AM    Edit  |   Quote  |   Report 
MySQL client
The testing client is Heidi SQL, which is working.
 Profile | Reply Points Earned: 0

 
Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.