简体   繁体   中英

Insert data into mysql from sql file or using csv file

I have an db.sql file and I tried inserting the data from it to my local MYSQL using the command: mysql -u root -p chitfund < db.sql . It doesn't show any error and also doesn't print anything. But when I try to see the tables in my db, it shows now tables. I have the data in the form of .csv also. I tried inserting using mysql.connector , but it is not installing and throws an error. Is there any other way to insert the data using the sql or csv files.

The problem was with my .sql file. It didn't have any insert or create statements. I assumed it has the statements and the data is not being inserted. After having all the insert statements for inserting the data, it worked properly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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