How do I push my mysql database from phpmyadmin to

2019-05-13 17:52发布

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

2条回答
等我变得足够好
2楼-- · 2019-05-13 18:02

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 password < exported_sql_file.sql

And 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.

查看更多
走好不送
3楼-- · 2019-05-13 18:08

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>
查看更多
登录 后发表回答