Import database from sql file [closed]

允我心安 提交于 2019-12-11 06:29:48

问题


I'm beginner in sql. I have a question, how can I import the database from sql file. I tried option "import a script file" but it doesn't work. I attach a screenshots and my sql file

screenshot

sql file

Thank you in advance for your help


回答1:


To get started, you will need:

A .sql script file containing a CREATE TABLE command
MySQL Query Browser or phpMyAdmin
Other MySQL database tools will require similar steps.
An empty MySQL database already created

MySQL Query Browser is part of the MySQL GUI Tools available at http://mysql.com/. These same steps can be used for most other MySQL administrator tools.

Using the MySQL Query Browser, connect to your MySQL Server.
From the Schemata panel, select the database you intend to add the new database table to.
Choose File > Open Script.
Navigate to the .sql file you wish to import.
Click Open.
Select Execute.
Confirm that the new database table appears in the Schemata panel.



回答2:


Just open a terminal,

login to mysql

use database,

source file/to/dump.sql




回答3:


You can use Command line for this.

Shell> mysql -u[username] -p[password] -h[hostname] dbname < sqlScript.sql


来源:https://stackoverflow.com/questions/20592497/import-database-from-sql-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!