Import a mysql database on the command line

September 24, 2020

mysql -u username database_name < file.sql

Stack Overflow Article

If you do not want to use the password on the command line then you can do the following:

For linux, add ~/.my.cnf and put the following in it

For MacOS with homebrew, add ~/.mysql.cnf and put the same contents in the file as above.

Note: some MacOS terminal setups my use the ~/.my.cnf instead.

Now, you can do the following command without using a password:

Personal Updates

This is a password protected section available to those who know me in some fashion. If you know me and you do not already have a login, you can request a login here.

Personal Updates
Book Reviews

I am nuts about books. I read on all kinds of topics. I attempt to review each book I read for the sake of my own enrichment as well as conversation starters with others.

My Book Reviews
The Attic

You never know what you will find in an attic! Usually there is a hodgepodge of things buried under dust.

Explore the Attic

Most of what is included here are notes to myself. The majority of folks will not find interest in these posts.

Technology Posts