HOW CAN I IMPORT A MYSQL DATABASE FROM THE TERMINAL?


In some cases, you do not have a PhpMyAdmin, and even if you do, it will always be faster to use the command line to import large databases.
As a general rule, I export all databases in compressed format (gzip). This makes them take up less space and I can upload or download them to other servers faster.
So, to have a single terminal command that does all the work:

gunzip < [dir/subdir/backup_DB.sql.gz]  | mysql -h [host_ip_or_name] -u [user_name] -p [database_name]


You only have to change what is between "[ ]" for your real data.
An example would look like this:

gunzip < [dir/subdir/backup_DB.sql.gz]  | mysql -h [host_ip_or_name] -u [user_name] -p [database_name]

Before it was a ticket. Now it's a prompt.

Does your Drupal leak?

Tell me what you are working on and what worries you. I'll reply personally and, if I'm not the right person, I'll tell you too.