我正在开发在Heroku上运行的简单PHP应用程序。我已经创建了一个CSV文件,并将其用作简单的数据库。
现在,我想在Heroku上创建一个数据库,所以我添加了一个Postgres实例,其名称为heroku-postgres-9f90a33a::ivory
。
我想知道如何创建和管理数据库实例以执行诸如创建表之类的操作。
主持人= ...
数据库= ...
用户= ...
端口= ...
密码= ...
现在,使用PostgreSQL的交互式终端客户端连接到数据库。
如果尚未安装,则必须转到平台的软件包管理套件(例如,在Ubuntu上运行sudo apt-get install postgresql-client),或转至postgresql.org,在该处可以找到可用的软件包。下载适用于FreeBSD,Linux,Mac,Solaris和Windows的预构建二进制软件包,以及其他安装选项。
To connect, call psql with the -h option to specify the server’s hostname, -U to specify the username, and then the database name:
root@yogesh-System-model:~# psql -h [**Host Name**] -U [**User Name**] [**database Name**]
Password for user hdwvhbehqlishy: ********
psql (8.4.9, server 9.0.5)
WARNING: psql version 8.4, server version 9.0.
Some psql features might not work.
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
df7r55a12o64m4==> CREATE TABLE [Table_name](your_id SERIAL, Name text, Address text);
这将创建一个表格。
我知道此问题的所有者已经解决了问题,但仍在发布此答案以供将来参考...。
如果有任何问题可以参考本教程
这是一种方法.....另一种方法是使用Jack DB,您可以在其中触发任何查询并查看位于Heroku的DB中的数据。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句