MySQL Import Database Schema

41,977

You're missing a <, which means you want to direct the content of the file into mysql.

mysql -u root -p [DB_NAME] < C:\Users\user_name\Downloads\file.sql
Share:
41,977
Richard Skinner
Author by

Richard Skinner

Updated on September 25, 2020

Comments

  • Richard Skinner
    Richard Skinner over 3 years

    I'm having issues attempting to import a database of 195MB via the command line.

    mysql -u root -p [DB_NAME] C:\Users\user_name\Downloads\file.sql
    

    When I run this command all I receive from MySQL is a list of variables and options available.

    What am I doing wrong?

    Also like to add I'm using a fresh install of XAMPP.

  • Richard Skinner
    Richard Skinner over 9 years
    My bad. Sometimes the smallest things get over looked.
  • Richard Skinner
    Richard Skinner over 9 years
    Wonder if you help on this dilemma. I have a SQL script - obviously - and i'm doing a string replace, looking for all occurrences of the live URL and replacing with the dev URL, however when this is done, it breaks the script. Now the script breaks in different places every time i try this. Also, the script works fine if i don't string replace. Confused.
  • fancyPants
    fancyPants over 9 years
    Would have to see the script. But it's not good to mix questions (it's a Q&A site, not a forum). Please ask this in a different question.
  • Richard Skinner
    Richard Skinner over 9 years
    Thought that might be the case so I've saved the question and will post in the next hour as the is blocking me from doing so. Thanks anyway.
  • Shafizadeh
    Shafizadeh almost 7 years
    Upvote .. just sometimes programmers also use -h in the command. Do you know what's that for?
  • fancyPants
    fancyPants almost 7 years
    For the hostname.