Reputation: 1837
I'm using WAMP server for running my php app. I have a database BOOK in phpmyadmin. How can I push this data to heroku. I have used add on to add cleardb to my app.
heroku config shows the database url too.
I tried
db:push mysql://root@localhost/BOOK
but it didn't work.
ERROR -->
Failed to connect to database:
Sequel::AdapterNotFound -> LoadError: cannot load such file -- mysql
Upvotes: 5
Views: 13520
Reputation: 4289
If you don't have mysql installed locally, type "mysql" into terminal will inevitably result in "command not found". MAMP provides command line syntax to resolve this problem. Thus, if we don't want to change $PATH to use 'mysql' command directly (there is really no need, in my opinion, if all we are going to use command line mysql for is database migration), we can run the following import syntax:
$/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot -u username -h hostname -p < exported_sql_file.sql
The CLI shall prompt for password input. And then the database in exported_sql_file.sql will be imported to clearDB. For how to acquire 'username', 'hostname', and 'password' for the import syntax, refer to this tutorial for help.
Upvotes: 2
Reputation: 11342
ClearDB recommends using mysql
and mysqldump
for importing data. From Frequently Asked Questions on ClearDB.com:
For importing data into your MySQL database, we recommend that you use both the mysql command line client as well as the mysqldump database backup utility.
Syntax for importing is something like this:
$ mysql <dbname> -u <username> -p<password> < <file.sql>
Upvotes: 4