Maintaining an Amazon Web Services Instance

From material semantics
Jump to: navigation, search

This article describes common maintenance tasks involving an Amazon Web Service Elastic Compute Cloud (EC2) instance.

Managing and transferring MySQL databases

Saving a database to a file

mysqldump -u root -pPASSWORD db_name > db_name.sql

Importing a database from a file

Log into MySQL.

mysql -u root -pPASSWORD

Create the database.

mysql> create database db_name;

Import the database contents from the file.

mysql -u root -pPASSWORD db_name < db_name.sql

Creating a user

The following can be used to create a user.

mysql> CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'PASSWORD';

The following grants the user all permissions on a database;

mysql> GRANT ALL PRIVILEGES ON db_name.* TO 'user_name'@'localhost';