Categories
blogs

Ubuntu 18 : How to import a MySQL .sql database

ssh to your server with a user that can sudo up, and have your details ready, and change to the directory where the .sql dump is located. Of course, maybe make a new database in the mysql server, so you don’t accidentally override anything.

mysql -u dbusername -p dbname < file.sql

The dbusername is the mysql username that has permissions to use the database.

The dbname is the mysql database that is available for that user to connect to, once the password is provided.

The file.sql is the database filename that you wish to import

The -p should not be populated, it will prompt you to enter the password.

By MrFloris

This blog is for people who know me, so nothing to tell. For those who don't know me yet, .. read my blog ;)