I would like to understand why I can't connect to my database using the ssh tunnel on dbeaver.
My database is hosted on a VPS using nginx.
I installed postgresql and created a user "userA" with a password "passwordUserA".
I created a new database "databaseA".
and gave the rights to the previously created user "userA
CREATE USER userA WITH PASSWORD 'passwordUserA' CREATEDB;
CREATE DATABASE databaseA;
ALTER DATABASE databaseA OWNER TO userA;
Now I would like to be able to connect to it remotely with dbeaver.
for the host ip: I enter the # ip of my remote server
the username: userA
the password: passwordUserA
the port: 22
dBeaver ssh connection settings
I should be able to connect to my database but dbeaver says "auth fail"
Does anyone know why the connection is not working properly?
For SSH connection you should to use linux system user with password (or ssh key) not database user.
After SSH connection established you put Database user and password on the 'Main' tab, using localhost as Host
Related
I am trying to connect to a VM ubuntu from my local computer. On the VM I have created a postgresql database. Then I followed all steps that I could find on several tutorial when it comes to allow access for remote connexion to the db:
add host all all 0.0.0.0/0 trust to the pg_hba.conf file
add listen_addresses = '*' to the postgresql.conf file
remove the firewall by executing sudo ufw allow 5432/tcp
restart postresql by executing sudo systemctl restart postgresql
By using the command psql and then \c gives You are now connected to database "postgres" as user "postgres".
I then create a password by executing ALTER USER postgres WITH PASSWORD 'password';
Then I use postico to connect locally. I want to connect with this same default superuser postgres for testing. I use the VM ip address as host, db name is postgres user postgres, password is password and port 5432 as mentioned above.
After trying to connect for a while with the message opening connection to server, the result is:
could not connect to server: Operation timed out
Is the server running on host "***.**.**.***" and accepting
TCP/IP connections on port 5432?
Any help please? I did all steps I could find on many tutorials but still failing to connect.
I just installed DBeaver on my personal computer and am trying to create a PostgreSQL database.
I entered the following in the Connect to database window:
Host: localhost
Port: 5432
Database: postgres
User: postgres
Those values were all pre-filled defaults, so I left them and clicked the Test Connection... button.
When I click the Test button an error window opens, saying, "Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. Connection refused: connect"
I tried setting my own db name and credentials, but get the same results.
How do I set up a local PostgreSQL database in DBeaver?
DBeaver does not allow to setup a local PostgreSQL server or instance: it allows to connect to an existing server or instance. If the PostgreSQL instance does not exist you should install PostgreSQL binaries and create a new database instance with initdb.
If your operating system is Windows 10 Home, you have to use 192.168.99.100 instead of localhost.
Answer from here - https://www.reddit.com/r/dbeaver/comments/fi8h0q/new_dbeaver_install_how_to_set_up_first/.
Dbeaver is just a client to the server. You need to setup the server itself first.
https://www.postgresql.org/
Download and setup the server then you can connect to it with DBeaver and do what you want to do.
I got the same, and then I remembered that I didn't start postgres with the script
Normally, I would create create postgresql user like this.
sudo -u postgres psql
create user deploy_sample with password 'secret';
create database deploy_sample_production owner deploy_sample;
I tried to create the user through ansible script with this task
- name: Create database user
become: yes
become_user: postgres
postgresql_user:
user: user123
password: password123
encrypted: yes
state: present
This does create a user but i cant login using the creds.
I tried to login with this command psql --username=user123 --password. I get peer authenticate failuer error.
Ansible configuration looks correct, and may have nothing to do with the problem.
By the message we can see that it is trying to login with the Peer authentication method. This means that the O.S. user is being used to connect to the database instead of the provided password (see: https://www.postgresql.org/docs/10/auth-methods.html)
Two things you should look at:
How is your auth method configuration?
It is in the file: {data dir}/pg_hba.conf
It is possible that all local connections are configured to use peer (notice that are two types of local connections, one is called local = connection through unix socket, the other is host 127.0.0.1/32 = using network to reach localhost).
I would change the second one to use md5 method, this way you will be able to connect with user/pass using network, but still use peer for local connection - useful for the system user postgres
Connect with the application user using network
psql --username=user123 -> PSQL program will try to use local connections by default, meaning that the Peer authentication is used. You probably don't have the user user123 on the system so this will fail!
psql -h localhost --username=user123 -d <database> -> This way you will connect to local machine using network, thus allowing to authenticate with password.
I have installed postgresql database and pgadmin4 on my fedora machine.
after starting the postgresql service and trying to connect to postgresql server
from pgadmin4
i am getting this error
Unable to connect to server:
FATAL: Ident authentication failed for user "postgres".
how should i fix this?
Did you create the "postgres" user while installing? You may be using wrong credentials, if you have forgotten the password, please change the pg_hba.conf (then reload or restart postgresql server) to allow all the connections from local without credentials, then change the password for postgres (again reload or restart postgresql) user. Change the pg_hba.conf to use credentials and try logging in.
I created a tomcat stack instance on google cloud and it comes with mysql 5.5. I can access it through terminal by ssh then enter command line mysql -u username -p. However, I am trying to access the database through mysqlworkbench but I could not get the connection.
So, I guess I need to use connection method "Standard TCP/IP over SSH" and I need to confirm if I have the parameters right.
SSH Hostname: the IP of my instances <br/>
SSH Username: my google account username? this is the one i use to login when setting up the gcloud ssh<br/>
SSH Password: the password for the account<br/>
SSH Key file: ~/.ssh/google_compute_engine<br/>
MySQL Hostname: i put tomcat_rmre which is the hostname for the database when I do "show variables" in the terminal<br/>
MySQL Server Port: the port in "Show variables"<br/>
Username: username of the database<br/>
password: password of the database
When I test connection, I get Lost connection to MySQL server at 'reading initial communication packet', system error: 0
The Tomcat Click to Deploy solution does not use Cloud SQL, it just includes MySQL running on Google Compute Engine.
If you are not able to connect to the MySQL instance remotely via the "Standard (TCP/IP)" connection method it is probably because of one of:
You may have forgotten to open TCP port 3306 in your GCE firewall.
MySQL may not be listening to remote connections. Your my.cnf should contain bind-address = 0.0.0.0 and should not have skip-networking.