MySQL Database and Composer Commands


How to restore all database backed up with mysqldump

  1. sudo mysqldump --all-database > NameOfFile.sql (will backup all the databases: on home level)

    Duplicate/clone Database (Pipe One database tables including Data into a New Database)
  2. Create a new Database then do this command
    mysqldump OldDatabaseName | mysql NewDatabaseName (Will dump all database into a previously created Database)

    Restore All Databases from SQL file
  3. mysql < NameOfBackedUpSQLFile.sql (On Home Level, will restore all the databases)

    Restore Only One Database from SQL dump file of all databases
  4. mysql -D NameOfTheDatabase -o < NameOfBackedUpSQLFile.sql (Will only restore one database)

    Transfer /Copy One Table from One Database to Another Database (This will create a new table and populate with data)
  5. Create TABLE DatabaseName.NewTableName SELECT * FROM AnotherDatabase.ExistingTable; (Will copy one table from one database into another Database)

    Rename Database
  6. Unfortunately, you can not rename the Database due to Security reasons, one way to this is by dumping your Database in SQL file then creating a new Database, finally import that SQL file and populate the tables.

    COMPOSER

    Export Composer to the Environment $PATH permanently
  7. echo 'export PATH="$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
  8. Then, type this command: source ~/.bashrc

    Drush Commands
  9. drush entity-updates (very handy for updating entities)
  10. drush update-entities (will do slightly different)

    Tar Unzip Folder in Linux
  11. tar -zxvf ourFile.tar
  12. rm -r NameOfFolder (will remove the folder)

    Resource
    Official Documentation can be found here

SQL
published
v.0.01





For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]