Tuesday, October 4, 2011

Some frequently used commands in Ubuntu Linux for SQL and DRupal

MYSQL : 
To create a database, to create a user and then to give all the permissions on that database to the user.



create database my_database_name_to_be_created; 
create USER 'username_to_be_created'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON  my_database_name_to_be_created.* TO 'username_to_be_created'@'localhost' ;
FLUSH ALL PRIVILEGES;



Linux/ Mysql : 
To take a dump of the data base.

mysqldump -u root -p databased_to_be_dumped> dump_file_name.sql;


To create a new database
mysql -u root -p name_of_the_database_to_which_dump_is_loaded < dump_file_name.sql

Linux : 

find . -maxdepth 1 -exec mv {} .. \;