如何检查heroku数据库的记录?

时间:2021-05-15 07:34:47

I've just deployed my application to heroku and pointed my custom domain to the heroku servers. How can I check the records in my heroku database?

我刚刚将应用程序部署到heroku并将我的自定义域指向heroku服务器。如何检查heroku数据库中的记录?

9 个解决方案

#1


38  

You can use heroku run rails console and look at your records with Model.all or any other method.

您可以使用heroku run rails控制台并使用模型查看记录。全部或任何其他方法。

If you want to backup the database look at heroku PG backups, you then can import your database on your local machine and look at it there. Depending on your db adapter you could use sqlite browser for sqlite3 or phpmyadmin for MySQL.

如果要备份数据库,请查看heroku PG备份,然后可以在本地机器上导入数据库并查看它。根据您的db适配器,您可以使用sqlite浏览器访问sqlite3或phpmyadmin访问MySQL。

#2


25  

I found a similar question like this and here is what @Chowlett says:

我发现了一个类似的问题@Chowlett说:

"You could run heroku pg:psql to fire up a Postgres console, then issue \d to see all tables, and \d tablename to see details for a particular table."

“您可以运行heroku pg:psql来启动Postgres控制台,然后发出\d来查看所有表,然后使用\d tablename来查看特定表的详细信息。”

You can also type select * from tablename; to view the table contents.

还可以从tablename中输入select *;查看表内容。

How to view current database schema for Heroku app in Terminal?

如何在终端中查看Heroku app的当前数据库模式?

#3


3  

heroku db:pull to pull your production DB locally to take a peek in it.

heroku db:在本地拉出你的产品db,以窥视它。

#4


3  

I'll give the method for connecting via a GUI tool

我将给出通过GUI工具连接的方法

Run the following command to get the database credentials from Heroku:

运行以下命令从Heroku获取数据库凭据:

heroku pg:credentials DATABASE_URL

Then you can use a GUI tool like PG Commander or PGAdmin to connect to the db

然后您可以使用一个GUI工具,如PG Commander或PGAdmin来连接到db

#5


2  

Heroku now has an add-on named PostgreSQL Studio (currently free & in beta) that would let you access your database from within the browser, without having to use CLI, much like PHP MyAdmin.

Heroku现在有一个名为PostgreSQL Studio的附加组件(目前是免费的,正在测试中),它可以让你在浏览器中访问数据库,而不必使用CLI,就像PHP MyAdmin一样。

To attach this add-on to your application,

要将此附加组件附加到您的应用程序,

heroku addons:create pgstudio

Then go to the list of add-ons on Heroku, select PostgreSQL Studio, authorize it, select the database to connect with from the dropdown list of all databases and it will take you to the web-based interface to handle your selected database.

然后转到Heroku上的附加组件列表,选择PostgreSQL Studio,授权它,从所有数据库的下拉列表中选择要连接的数据库,它将带您到基于web的接口来处理所选的数据库。

You may refer to this official article on Heroku: https://devcenter.heroku.com/articles/pgstudio

您可以参考Heroku的这篇官方文章:https://devcenter.heroku.com/articles/pgstudio

#6


1  

The easy answer is:

最简单的答案是:

heroku pg:info

heroku pg:信息

#7


1  

You can also download a client side Postgres, like Postico, and using the information provided in that URL to enter password and database name etc, then you can create locally, just like phpMyAdmin.

您还可以下载客户端Postgres,如Postico,并使用该URL提供的信息输入密码和数据库名称等,然后您可以在本地创建,就像phpMyAdmin一样。

#8


0  

I use the admin_data gem, works well in Heroku.

我使用admin_data gem,在Heroku中运行良好。

#9


0  

You can use heroku dataclips that allows to run queries online. Here you can find documentation https://devcenter.heroku.com/articles/dataclips.

您可以使用heroku dataclips支持在线运行查询。您可以在这里找到https://devcenter.heroku.com/articles/dataclips。

#1


38  

You can use heroku run rails console and look at your records with Model.all or any other method.

您可以使用heroku run rails控制台并使用模型查看记录。全部或任何其他方法。

If you want to backup the database look at heroku PG backups, you then can import your database on your local machine and look at it there. Depending on your db adapter you could use sqlite browser for sqlite3 or phpmyadmin for MySQL.

如果要备份数据库,请查看heroku PG备份,然后可以在本地机器上导入数据库并查看它。根据您的db适配器,您可以使用sqlite浏览器访问sqlite3或phpmyadmin访问MySQL。

#2


25  

I found a similar question like this and here is what @Chowlett says:

我发现了一个类似的问题@Chowlett说:

"You could run heroku pg:psql to fire up a Postgres console, then issue \d to see all tables, and \d tablename to see details for a particular table."

“您可以运行heroku pg:psql来启动Postgres控制台,然后发出\d来查看所有表,然后使用\d tablename来查看特定表的详细信息。”

You can also type select * from tablename; to view the table contents.

还可以从tablename中输入select *;查看表内容。

How to view current database schema for Heroku app in Terminal?

如何在终端中查看Heroku app的当前数据库模式?

#3


3  

heroku db:pull to pull your production DB locally to take a peek in it.

heroku db:在本地拉出你的产品db,以窥视它。

#4


3  

I'll give the method for connecting via a GUI tool

我将给出通过GUI工具连接的方法

Run the following command to get the database credentials from Heroku:

运行以下命令从Heroku获取数据库凭据:

heroku pg:credentials DATABASE_URL

Then you can use a GUI tool like PG Commander or PGAdmin to connect to the db

然后您可以使用一个GUI工具,如PG Commander或PGAdmin来连接到db

#5


2  

Heroku now has an add-on named PostgreSQL Studio (currently free & in beta) that would let you access your database from within the browser, without having to use CLI, much like PHP MyAdmin.

Heroku现在有一个名为PostgreSQL Studio的附加组件(目前是免费的,正在测试中),它可以让你在浏览器中访问数据库,而不必使用CLI,就像PHP MyAdmin一样。

To attach this add-on to your application,

要将此附加组件附加到您的应用程序,

heroku addons:create pgstudio

Then go to the list of add-ons on Heroku, select PostgreSQL Studio, authorize it, select the database to connect with from the dropdown list of all databases and it will take you to the web-based interface to handle your selected database.

然后转到Heroku上的附加组件列表,选择PostgreSQL Studio,授权它,从所有数据库的下拉列表中选择要连接的数据库,它将带您到基于web的接口来处理所选的数据库。

You may refer to this official article on Heroku: https://devcenter.heroku.com/articles/pgstudio

您可以参考Heroku的这篇官方文章:https://devcenter.heroku.com/articles/pgstudio

#6


1  

The easy answer is:

最简单的答案是:

heroku pg:info

heroku pg:信息

#7


1  

You can also download a client side Postgres, like Postico, and using the information provided in that URL to enter password and database name etc, then you can create locally, just like phpMyAdmin.

您还可以下载客户端Postgres,如Postico,并使用该URL提供的信息输入密码和数据库名称等,然后您可以在本地创建,就像phpMyAdmin一样。

#8


0  

I use the admin_data gem, works well in Heroku.

我使用admin_data gem,在Heroku中运行良好。

#9


0  

You can use heroku dataclips that allows to run queries online. Here you can find documentation https://devcenter.heroku.com/articles/dataclips.

您可以使用heroku dataclips支持在线运行查询。您可以在这里找到https://devcenter.heroku.com/articles/dataclips。