Insights

How to import data into mysql db from sql file

Open your shell prompt

navigate to the mysql directory (default is /var/lib/mysql)
cd /pathToYourMysqlDirectory/

then type the below command

$ mysql -u mysqlUserName -p Password -h HostName DatabaseName < /loactionOfYourSqlFile/yourSqlFileName.sql

Where
mysqlUserName = Mysql User Name
Password = Mysql User Password
HostName = Mysql Host Name (This could be local host or some remote IP where you want to import the database)
DatabaseName = Mysql Database Name
/loactionOfYourSqlFile/yourSqlFileName.sql = This is the location of your sql file

Note : This is work only in Linux system

Thanks

Turn insight into action

Need help with mysql or a related project?

If this article sparked an idea, question, or project direction, I can help you turn it into a practical next step.

Start a conversationChat on WhatsApp

Related reading

Articles connected to this topic

linux

export mysql database – mysql dump

When you have access to the command line and you have the export large database, you will not be able to export from phpmyadmin. Hence mysql provide you handy method to export the database from the command line. Below are various options, you can use while exporting the database. ——databases – This allows you to [&hell

Apr 14, 2020

Read article

Most recent

Latest posts from the blog

View all articles →