I setup psql and pgadmin on my mac. I can create database and tables on both but they don't seem to connect - database

I have psql installed on my mac. The databases on psql and pgadmin are different and I can't seem to connect them to each other. I would like to be able to create a database and table in psql and have it also available in pgadmin but unable to so far. I tried google and stackoverflow with no success.
The psql shell on my mac is version is 10.4
The pgadmin gui on my mac is version 3.0
Is there any way that these two can be connected to each other so I can manipulate database with either?
I've created a database on pgadmin using the GUI and/or through jupyter notebook via sqlalchemy but it doesn't show up on psql. I've created a database and table on psql but it doesn't show up on pgadmin.
Not sure what I'm doing wrong? Tried to google to see if I can connect to pgadmin from psql but couldn't find anything.
Let me know what I'm doing wrong and how I can connect those two. Thanks

So, you've got two postgresql installs one version 9.6 as a system install and one 10.4 as a user install.
The system install is on port 5432 which is the default port number, so there's something overriding the psql connection so that it finds the version 10.4.
There should be a psql somewhere that came with the 9.6 install.
if you run that one it should connect you to the 9.6.
if that was the enterprisedb installer it looks like
/Library/PostgreSQL/9.6/psql
might be the one you need.
perhaps some mac-os guru can fill in the blanks like how to set the search path to find that psql first.

Related

The pgAdmin 4 server could not be contacted

I found somebody asking the same question almost 6 years ago, versions are changed and i can't make it work
This are the versions im working with:
Windows 11
pgAdmin 4 v6.17
postgresql 14.6.1
I changed PC and i had to reinstall evrything...
So basically i installed pgAdmin with the installer you can find on their web site (here https://www.pgadmin.org/download/pgadmin-4-windows/), and postgresql with the installer you can find following the steps from pgadmin website (this is the link: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads)
If i manually shutdown postgresql pgAdmin will work but obviously i can't use a local DB
If i keep postgres active locally pgAdmin wont open due to Fatal Error:The pgAdmin 4 server could not be contacted , i got no more info
The problem is that i need to work with DB both locally and in remote
i tried reinstalling both pgAdmin and postgres, and executing pgadmin as administrator made no difference
I think is related to the port usage, like they are both tring to use port 5432, but i don t know
Anything i can try?

How to turn off database sybase v 15.7?

I have an aix server running a sybase database, I need to turn off a specific database, how can I resolve this?
the application that I use to work in this database is Artisan and / or via ssh with putty

Is it possible to inventory MSSQL-Linux running within Docker?

Part of my job involves data collection to help size workloads that could be transferred to the cloud. An element of this is being able to enumerate SQL instances within a client's environment for insights such as "hey you have some out of support legacy SQL here that was supposed to be decommed years ago, what's the deal."
With the release of SQL Server 2017, I've just now created an instance of the SQL Server Enterprise 2017 on Linux container (using this image) that I'm running locally on Windows 10. I can connect to the instance via SSMS and SELECT ##VERSION to confirm it's legit, but my question is if it is possible to inventory the device and find the SQL instance without knowing that connection string.
Things I've tried:
-Running on Windows 10 so I believe this is supported via Hyper-V, when I try to go through the Hyper-V manager to connect to the VM Docker spun up, can't get any interface there (which I figured, since Docker emulates apps rather than full VMs)
-Tried to do a sqlcmd -L from the Win10 host device and don't see the instance (Don't have SQL installed on the Windows 10 device I'm running this from)
-I can find the docker image via a docker ps, then exec -it to bash, and use sqlcmd from there, but the sqlcmd -L isn't listed as an option within Linux.
-ipconfig from the host device shows the Docker IP address, but it wouldn't give me the port information so I would have to scan through all the ports which feels dirty.
I'm kind of at a loss at this point. If I didn't explicitly know a Docker container was running MSSQL-Linux, is there any way I could identify that from inventorying the host device? (sorry for the long post)
After banging my head on it for a bit I've found a painful workaround of:
connect to the container's bash using: docker exec -it <container_name> "bash"
then using ps aux | grep sql to list all of the sql processes. The MS image shows up as /opt/mssql/bin/sqlservr from local testing. Once SQL has been identified you can attempt to connect to it using the Docker ip from ipconfig and the port from docker ps
It's not elegant, but it should be possible to automate those steps for use across a set of unknown devices.
Leaving this open for a bit for any better alternatives.

how to use phpmyadmin with Amazon RDS

I am trying to use amazon for the first time. I have created a database instance and it is up and running. I want use this database. I tried it using terminal in my mac by following command:
mysql -h xxxxx.xxxxxxxxx.us-east-1.rds.amazonaws.com -P 3306 -u mymasteruser -p
But I am getting error as following:
-bash: mysql: command not found
can some one help me how to connect to database from here and also how should I access it from Phpmyadmin. I have all the details about the database but I am not sure about how to get url for phpmyadmin.
Thanks
Pankaj
Make sure you have made security group to allow access from outside of AWS for port 3306.

PostgreSQL Database Creation on Remote machine

Can we create a database on remote machine in postgresql DB, if yes then how?
Yes. Assuming the remote server is Linux, and assuming you have sudo or root privileges on that server, you could SSH into the remote server and use a package manager (like yum, synaptic, or apt) to install the PostgreSQL server.
You can configure it using vi (or emacs or other text editor). Usually, the files you edit are found in the /var/lib/pgsql/data folder, and an /etc/init.d/postgresql startup script for whenever the server reboots. You'll usually need to edit the pg_hba.conf file to allow a connection from your client's subnet. That part can be troublesome if overlooked.
You'll be able to initially run psql as the postgres user, and can create datatabases, run scripts, etc from the command line. Once you allow a remote connection, you can do the same from the comfort of your own gui, such as PgAdminIII or any Java-based database manager that can use a JDBC connector.
Example:
psql -U postgres
create database foo;
\q
First, get your programming language. Let say it's PHP to make it simple.
Second, you get the PostGresql connector. Here is the link for PHP but you can get for all popular language.
Third, you open a connection and you do the command you want. You want to create a database so you call the create database YourDatabaseName command.

Resources