简体   繁体   English

将数据导入mysql中的db

[英]import the data to db in mysql

I have sql data in .sql format. 我有.sql格式的sql数据。 and I need to import it to the MySql database. 并且我需要将其导入MySql数据库。 What are all the steps should I take. 我应该采取什么所有步骤。 Thanks in advance. 提前致谢。

Your .sql file only contains a lot of SQL queries. 您的.sql文件仅包含许多SQL查询。

The simplest way to import your file is to execute those SQL queries, with the mysql command-line tool : 导入文件的最简单方法是使用mysql命令行工具执行这些SQL查询:

mysql --user=USER --password=PASSWORD --host=HOST DB_NAME < your_sql_file.sql

This will send all the content of your_sql_file.sql to the mysql program, which will execute it -- and, so, import your data. 这会将your_sql_file.sql所有内容发送到mysql程序,该程序将执行它-从而导入数据。


Of course, you'll have to replace the upper-case USER , PASSWORD , HOST , and DB_NAME with your real connection informations. 当然,您必须用实际的连接信息替换大写的USERPASSWORDHOSTDB_NAME

Are you using any software to connect with mysql? 您在使用任何软件连接mysql吗? If yes, then there should be opion for importing data. 如果是,则应该选择导入数据。 Try that. 试试看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM