mysql import on windows

前端 未结 6 588
梦毁少年i
梦毁少年i 2021-01-31 09:49

I have a MySQL file, db.sql. I have tried to import it using:

mysql -uroot -p[password] db < db.sql

All I get is a listing of m

相关标签:
6条回答
  • 2021-01-31 10:12

    If you are already logged in the try this it will be very useful, but depend upon the MySQL version, it works on MySQL 5.0

    For log in if you are not already logged in.

    mysql>[your password]

    Other wise, use the database to which you want to import the SQLDump file by command.

    mysql>use [your database name]

    And then give source the database Dump file path as blow command(If not works the copy Dump database file to the bin folder where the MySQL installed for eg. "C:/programfiles/mysql/mqlserver5.0/bin")

    mysql> source [dataBasePath+name.sql or dataBaseName.sql]

    0 讨论(0)
  • 2021-01-31 10:15

    Not sure if your example was a typo or not, but for starters you need to have a space in between your flags and their values, roughly like this:

    mysql -u root -p [password] db < db.sql
    
    0 讨论(0)
  • 2021-01-31 10:16

    Try this instead:

    mysql -u root -p
    (prompts for password)
    use db;
    source db.sql
    
    0 讨论(0)
  • 2021-01-31 10:31

    I've been using PHP script called "BigDump": http://www.ozerov.de/bigdump.php

    0 讨论(0)
  • 2021-01-31 10:33

    This perfectly works

    mysql>[your password]

    Other wise, use the database to which you want to import the SQLDump file by command.

    mysql>use [your database name]

    And then give source the database Dump file path as blow command(If not works the copy Dump database file to the bin folder where the MySQL installed for eg. "C:/programfiles/mysql/mqlserver5.0/bin")

    mysql> source [dataBasePath+name.sql or dataBaseName.sql]EG: source C:.....sql

    I am using mysql server 5.5

    0 讨论(0)
  • 2021-01-31 10:34

    I found out it is different to run this command from Windows Command Line (cmd.exe) and Windows PowerShell.

    Using CMD.exe the command works okay, but in PowerShell I get this error:

    mysql -uroot exampledb < exampledb.sql
    

    The '<' operator is reserved for future use.

    0 讨论(0)
提交回复
热议问题