Create database
mysqladmin -u -p create dev_drupal
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON dev_drupal.* TO root@'localhost IDENTIFIED BY ;
Drop all table
drush sql-drop --db-url=mysql://root:@localhost/dev_drupal
drush sql-dump --result-file= /var/www/dev_633.sql
Restore db
drush sql-drop
drush sqlc < /home/db/dev_drupal1.sql
drop table drupal_install_test; drop table role_permission; drop table date_format_type ;
truncate table cache_block;
truncate table cache;
truncate table cache_content;
truncate table cache_filter;
truncate table cache_form;
truncate table cache_menu;
truncate table cache_views;
SQL – drop all table
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SET GROUP_CONCAT_MAX_LEN=32768;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables, '') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET FOREIGN_KEY_CHECKS = 1;
Autres commandes
drush enable cck
drush cron
drush refresh
drush sql dump > mydb.sql
drush sql cli
drush cache clear
drush updatedb
Module install and update
drush dl token pathauto
drush en token pathauto
drush updatedb
pm-list
drush pm-list --no-core --pipe --type="module"
Références: