Restore MYSQL Dump File with Command Line

前端 未结 9 1446
长情又很酷
长情又很酷 2021-02-04 02:57

I have file.sql, and I want to restore it. I found this command:

mysql -u username -p database_name < file.sql

Where should I put \'file.sql\' in

相关标签:
9条回答
  • 2021-02-04 03:30
    Import Database
    1. Go to drive
    command: d:
    2. Mysql login
    command: c:\xampp\mysql\bin\mysql -u root -p
    3. Will ask for pwd: enter it
    pwd
    4. Select db
    use DbName;
    5. Provide file name
    \. G:DbName.sql
    
    0 讨论(0)
  • 2021-02-04 03:30

    you need to point to the location of your file using:

    mysql -u username -p database_name < drive:\\path_to_your_file\file.sql
    
    0 讨论(0)
  • 2021-02-04 03:32

    Type the following command to import sql data file:

    $ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql
    

    In this example, import 'data.sql' file into 'blog' database using vivek as username:

    $ mysql -u sat -p -h localhost blog < data.sql
    

    If you have a dedicated database server, replace localhost hostname with with actual server name or IP address as follows:

    $ mysql -u username -p -h 202.54.1.10 databasename < data.sql
    

    OR use hostname such as mysql.cyberciti.biz

    $ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql
    

    If you do not know the database name or database name is included in sql dump you can try out something as follows:

    $ mysql -u username -p -h 202.54.1.10 < data.sql
    

    Refer: http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

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