问题
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