Replace Mysql database from one Computer to Other in Rails as we do in sqlite3

雨燕双飞 提交于 2019-12-11 09:47:46

问题


I switched to mysql dtabase in Rails.I got a databse.sql file generated in db folder.But when i login to mysql and check data in tables then there is no records present in tables.

i used this command for dump

mysql –u root –p database_name < database_name.sql

there was no error while executing this command but when i checked the tables then there were no records in the tables.So please help me to insert all my records in database using database.sql file.There is one fiel generated database.sq.IO ned to copy this file to another pc and make all my records to insert.So how may i do this.


回答1:


You can import .sql file using the standard input like this:

mysql -u <user> -p<password> <dbname> < file.sql

Note: There shouldn't space between -p and password



来源:https://stackoverflow.com/questions/43088609/replace-mysql-database-from-one-computer-to-other-in-rails-as-we-do-in-sqlite3

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