Where and how do i upload my database files?

Posted March 13, 2015 9.4k views

I am unable to find the phpMyAdmin panel so as to upload my database files. I was hinted that i could import my files through the CLI with the command (below) after i have uploaded my sql file in the home directory.
mysql -u root -p $database

I have done so much and on entering the command, it displays a ‘Welcome to SQL monitor’. However, after that, i am neither able to upload my db files (if they aren’t already there). And if they are supposed to have been uploaded with that command, then I’m unable to see the tables and data. Also, my site isn’t working. So , how exactly do I upload my db files?

Could someone please help me out? Does it require me to install phpMyAdmin somewhere first? (I am using a Windows machine.) And if so, how?

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You will first want to upload your .sql file to your droplet using an SFTP client like Filezilla. Then, in the directory where your .sql file is located you can run

mysql -u username -p database_name < file.sql

to import your database’s tables and data. This will only populate a database and not create one so if you have not yet created the empty database you will need to do so with:

mysql -u username -p

This will get you to an interactive mysql shell. You can then run the following to create your database.