- Login to AWS console
- Start a machine with AMI:- ami-2547a34c
- Make sure required ports are open in the security group that you used
- MYSQL:-3306
- SSH:- 22
- After the server is up, login to the server using ssh
- Install the mysql server :-
yum -y install mysql mysql-devel mysql-server
- start the server:-
/etc/init.d/mysqld start
- By default, mysql doesn;'t provide any password for root. This is dangerous, so first thing you do is set a password:-
mysqladmin -u root password
- By default root has permissions to only login from localhost. So, give permission to root to login from anywhere:-
mysql -u root -p
grant all on *.* to root@'%'
Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts
Friday, July 31, 2009
Creating a Fedora machine with MYSQL on Amazon
Thursday, July 23, 2009
Attaching and detaching a MYISAM datbase
Let's say you have a huge MYSQL database in one MYSQL instance. You want to make a copy of this database in another MYSQL instance. There are several ways you can do a copy
1) Export the database:- Use Mysqldump. Basically, this creates a huge SQL file that contains all the SQL statements for creating and populating data into the database. This way is good for creating empty starter databases, because you can easily change the schema by changing the SQL. A good tutorial is here
2) Just copy the database:- This works only for ISAM tables.
First a short background on how MYSQL stores data:- If you look into your MYSQL data folder, you will see that there is a folder for every database in the MYSQL instance. This folder has 3 files for every table in the database
So, this is how you detach and attach the database from one instance to another:- You just copy the folder that holds the database to the data folder of the instance you are attaching the database to. That's it! You don't even have to restart MYSQL.
1) Export the database:- Use Mysqldump. Basically, this creates a huge SQL file that contains all the SQL statements for creating and populating data into the database. This way is good for creating empty starter databases, because you can easily change the schema by changing the SQL. A good tutorial is here
2) Just copy the database:- This works only for ISAM tables.
First a short background on how MYSQL stores data:- If you look into your MYSQL data folder, you will see that there is a folder for every database in the MYSQL instance. This folder has 3 files for every table in the database
- frm table - I think this file contains the schema of the table
- myd table - for an ISAM table, this file holds the data. A InnodDB table doesn;t have any data in this file. The data is stored in a seperate file outside of the folder
- myi table - this file holds the indexes
So, this is how you detach and attach the database from one instance to another:- You just copy the folder that holds the database to the data folder of the instance you are attaching the database to. That's it! You don't even have to restart MYSQL.
Subscribe to:
Posts (Atom)