How To Create A Second Database Schema In The Same RDS Instance On Amazon RDS

If you want to create another user with master user and that will create another database schema in running RDS instance . So you may follow the below steps. connect your RDS instance through master password and user ( which is create on RDS creation time) from Bash shell.

# mysql -h <....rds.amazonaws.com> -u linuxpoint -p

now in RDS instance (mysql) shell prompt.

Note: User: awspoint  and DatabaseName: linux_point –  replace this both with your database name and user name and remove “<>” this. 

mysql> CREATE USER '<awspoint>'@'%' IDENTIFIED BY '<password>';
mysql> CREATE DATABASE <linux_point>;
mysql> GRANT ALL PRIVILEGES on <linux_point>.* To <awspoint>@'%';
mysql> GRANT ALL PRIVILEGES ON `<linux_point>`.* TO '<awspoint>'@'%';
mysql> FLUSH PRIVILEGES;

Now you may see your newly created database mysql> SHOW databases;

Now you have to exit this, mysql> \q;

And now you be able to login with new user with new_database

# mysql -h <....rds.amazonaws.com> -u <awspoint> --database <linux_point> -p
mysql>_

And now you be able to restore the dump (from bash shell) in your newly database or you can create tables and all whatever you want with it which will be valid as per requirements.

# mysql -h <....rds.amazonaws.com> -u <awspoint> --database <linux_point> -p < dump.sql
@Thank you

SaveSave

Advertisements

Backup Of MySQL Database To Amazon S3 Using BASH Script Is Not Rocket Science! Learn Them Now!

s3backupBackup of MySQL Database to Amazon S3 using BASH Script

This is a easy way to backup your Mysql Database  to Amazon S3 for a regular interval backup – this is all to be done on your server.

First need to have the checklist  i.e must important for the any task you want to do in a proper way.

  • S3cmd  command line configure on server
  • A bucket over S3 to store dump file
  • Make Bash Script  i.e Contains MySQL Credential ( Hostname, Username, DB Name ), Location on your server where you want to store dump (PATH), Log Path.
  • Give chmod  +x on mysqlbackup Script (mysql.sh)
  • Test it and check S3 bucket
  • Schedule with cron as per your requirement

Continue reading