Archive for May 28th, 2009

28th May
2009
written by Tristan

This is something that I have to do on a fairly regular basis, and I always have to look it up in a book or something to remember how to do it, as such I figured there would probably be other people who keep doing the same, here’s how to do it:

  • mysql -h(host) -u(username) -p(password) (database) < (data_file)

You don’t need the brackets (), they are just there to delimit the variables that need to be replaced. The datafile should be a .sql file, and I’ve found that sometimes, depending on the setup, you don’t always need to specify the host, in cases like this just remove the -h(host) and run the rest of it.