My apologies for this lengthy post. I have been trying to find out the best way manage my databases outside of using phpMyAdmin. Several of you have been kind enough to help, but I am still confused. I hope I am not being a pain, but I just need a little more guidance and I’ll be on my way (and hopefully be in a position to help other noobs with similar questions).
I has been suggested that the best way to manage databases is through shell. That being the case, could someone please help me with the different commands?
[WHAT I HAVE LEARNED]
Through another thread, Ipstenu-DH and sXi explained how to log into my server via ssh and how to create a backup using this command:
mysqldump --opt --user=username --password=password --host=yourMySQLHostname dbname > output.sql
This I have been able to do. But then, on a different thread, when I inquired about importing/exporting my database, sierracircle suggested these commands:
export: mysql --user=cheese_dbadmin --password=yourpassword --host=mysql.cheeseball.com cheeseball_db < cheeseball.sql
import: mysql --user=cheese_dbadmin --password=yourpassword --host=mysql.cheeseball.com cheeseball_db > cheeseball.sql
[SO MY QUESTIONS ARE…]
Is there a difference between backing up and exporting a database? (I noticed the < is facing in opposite directions.)
If using the backup command above (mysqldump), can I replace the word ‘output’ with my database name, or does it have to be entered as output.sql?
If I import my database using the import command above, will it overwrite my existing data or add to it?
If the answer to #3 above is to add to it, could someone tell me the command for overwriting an existing database?
Am I assuming correctly that to import a database, all I need to do is make sure that a copy of the database I am wanting to import has been uploaded to my root directory (home/username) and that there is a database by the same name at my MySQL server (mysql.mydomain.com)?
Thank you everyone for your time!