Question

I got a new laptop and want to move my entire development environment, as is, to my new machine

Everything was incredibly easy, except for the MySQL database, which is turning out to be a complete nightmare. Eventually, I copied it to my new machine and got it set up, using the following:

mysqldump -u root -p tillyoudrop_dev > tillyoudrop_dev.sql

mysql -u root -p tillyoudrop_dev < tillyoudrop.sql

But when I enter the rails console, I find that only the tables seem to have copied, but no data...

For example , when I enter User I get

2.0.0-p451 :003 > User
 => User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, created_at: datetime, updated_at: datetime, cart_id: integer, superadmin: boolean, invitation_token: string, invitation_sent_at: datetime, invitation_accepted_at: datetime, invitation_limit: integer, invited_by_id: integer, invited_by_type: string) 
2.0.0-p451 :004 >

which is the desired, correct behaviour, but when I look for entries:

2.0.0-p451 :004 > User.count
   (0.3ms)  SELECT COUNT(*) FROM `users` 
 => 0 
2.0.0-p451 :005 > 

There are none. How do I copy the actual data from my old dev environment to my new one?

Was it helpful?

Solution

Instead of loading the data directly from the command line, import the file from within mysql itself:

$ mysql -u root -p tillyoudrop_dev

mysql> \. tillyoudrop_dev.sql

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top