I can't connect to mysqlfabric - mysql-fabric

I can't connect to mysqlfabric on port 32275.
I am connecting on port 3306 to database so all the grants are in place . On port 32275 I get a message
ERROR 1044 (42000): [Fabric] Access denied
for user and in log I can see
[INFO] 1441810699.948011 - MySQL-RPC-Session-4 - User 'john'
denied access which suggests permissions issue.
I can log in to database if I use
mysql -u fabric -p -h localhost -P 32275
but if I use
mysql -u fabric -p -h host-ip-address -P 32275
I get above error. I can see in netstat that server is listening on that port.
What am I doing wrong ?

There are a couple of things to check in the fabric config.
Firstly try disabling RPC authenication until you have it up and running.
[protocol.xmlrpc]
disable_authentication = no
Also check your storage section and test you can connect using these settings.
[storage]
address = 192.168.0.1:3306
user = fabric_store
password = secret
database = mysql_fabric
auth_plugin = mysql_native_password
mysql -u fabric -psecret -h 192.168.0.1 -P 3306 fabric_store

Related

how to connect Redshift from putty?

I am trying to connect redshift from my local windows putty instance. After creating Redshift instance , it is generated leader and compute node ip address.
Question is
which node role i need to pick ? Compute / Leader
for those which ip address i need to pick ? private / public
How to add public SSH key into my local putty?
You cannot SSH into a Redshift cluster since Redshift is a fully managed data warehouse service. All cluster administration is done by the Redshift service.
To connect to the Redshift database from the command line you use psql. This is installed as part of a Postgres installation. Any version of Postgres or psql later than 8.0 should work.
Alternatively you can connect using any SQL tool that support JDBC or ODBC.
You would normally connect to the Endpoint address but, if needed, you can also connect to the Leader node IP address.
psql -h my-cluster-name.ahashvalue.us-west-2.redshift.amazonaws.com -p 5439 -d mydatabasename -U masteruser
Or
psql -h 54.nnn.nnn.nnn -p 5439 -d mydatabasename -U masteruser

Cannot connect to the sandbox instance due to password authentication failure

Hi~~ I'm doing the official tutorial from the follwoing link.
My system is windows 10, I'm using VirtualBox 6.0 and downloaded the latest sandbox.
The following are what I did step by setp:
(1) Boot up: I cannot upload image but the information on boot up are as follow:
Hostname: gpdb-sandbox.localdomain
IP: 192.168.5.138
GPDB Admin: gpadmin
GPDB Password: pivotal
Tutorial User: gpuser
Tutorial User Password: pivotal
(2) Navigate to pg_hba.conf and add "host all all 0.0.0.0/0 md5" to the last of it
(3) Navigate to postgresql.conf and add "listen_addresses = '*'" to it
(4) Then I loged in the OS and run the following commmand
./start_all.sh
(5) Then I opened a cmd.exe from my windows and run
psql -U gpadmin -h 192.168.5.138 -p 5432 postgres
(6) The program replies with request for password, then I typed in "pivotal"
And then the program replies with an authentication failure. Can anyone help me with that so that I can start the first step of the tutorial??
Thanks a lot!
No need to type all the parameters if you are connecting to database from the sand box terminal.
just do psql and press enter you will be connected to gpadmin database.
if you changeor add any entries in pg_hba.conf please relode the configurations by running below command.
gpstop -u

AWS DocumentDB through Proxy

I have an AWS DocumentDB set up that I can connect to just fine through my jump box using:
mongo --ssl --host aws-host:27017 --sslCAFile rds-combined-ca-bundle.pem --username my_user --password <insertYourPassword>
I'd like to be able to connect to it through localhost for some testing. I cannot connect directly so I attempted to open a tunnel from my jump:
ssh -i ~/.ssh/my-key user#my_jump -L 27017:aws-host:27017 -N
After that I tried the basic MongoDB connect command:
mongo --ssl --host localhost:27017 --sslCAFile rds-combined-ca-bundle.pem --username my_user --password <insertYourPassword>
I get an error I understand:
The server certificate does not match the host name. Hostname: localhost does not match SAN(s)
I tried using export http_proxy to use http://my_jump:27017 and using the command above again with no luck.
Any suggestions or help on how to connect?
Try to disable ssl hostname validation:
mongo --ssl --sslAllowInvalidHostnames ...
Note --sslAllowInvalidHostnames is available from version 3.0.
If this does not work, try to remove --ssl entirely from the connection options, as according to the documentation:
The mongo shell verifies that the hostname (specified in --host option
or the connection string) matches the SAN (or, if SAN is not present,
the CN) in the certificate presented by the mongod or mongos. If SAN
is present, mongo does not match against the CN. If the hostname does
not match the SAN (or CN), the mongo shell will fail to connect.

Failed login to Docker postgres image via localhost with published port, but accessible by external IP

I'm trying a simple setup with a docker postgres image, publishing a port for me to connect from the localhost.
docker run -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=password -e POSTGRES_USER=postgres -d postgres
I'm able to connect just fine if I specify the docker external IP:
psql -h 192.1469.99.100 -p 5432 -U postgres -d postgres --password
However I get a password authentication failure when trying against localhost:
psql -h localhost -p 5432 -U postgres -d postgres --password
psql: FATAL: password authentication failed for user "postgres"
Do I need to set up some manual port forwarding manually? The weird thing is that it seems to connect to the postgres server just fine, it's just bizarrely telling me the password fails. I've done something wrong with the docker config perhaps?
The pg_hba.conf looks like:
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
The host machine is Windows 7.
Did you try another port than 5432? Try some free port so that there is no conflict between your local postgre and your docker postgre. To me it looks like your local postgre is having higher prio on localhost:5432, takes the traffic and so you are trying to login to your local postgre instead of your docker postgre, but obv. just a guess.
Did you check if you have this port allowed in the virtual machine or whatever you use for virtualization?
The container has its own network and its loopback address does not refer to the host and vice versa.

Forgot Admin Password on Postgres (Windows Installation), can't reset

I have a Windows PostgreSQL installation.
According to some posts, there is no default password set for the 'postgres' user yet I can't connect using an empty password string.
I'm receiving this exception when I try to connect:
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
The most relevant tip was this:
https://stackoverflow.com/a/25943227/1005607
Open pg_hba.conf
Change md5 -> TRUST
then restart PgAdmin.
I tried that and restarted PGAdmin but it still asks me for the password when I try to connect:
The task manager in Windows shows some PostgreSQL processes are running. I can't switch them off.
I have tried this and it failed:
pg_ctl restart
ERROR:
pg_ctl: no database directory specified and environment variable PGDATA unset
psql.exe postgres
Password: (none)
ERROR:
psql: fe_sendauth: no password supplied
How can I reset the default password for user 'postgres'?
Based on AK47's answer and some additional info I fixed it by doing the following,
1) Stop Postgres if currently running, command line below. Need to give it the 'data' dir. In my case C:\PostgreSQL\data
pg_ctl -D C:\PostgreSQL\data stop
2) Edit the file pg_hba.conf (it's also in the \data dir) as follows:
As AK40 wrote, change all MD5 references to trust , e.g.
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
3) Now run
psql -U postgres
4) In the PG Command Prompt that appears type,
ALTER USER Postgres WITH PASSWORD '<newpassword>';
5) Save this by typing wq enter to exit the PG Prompt
6) Now start Postgres
pg_ctl -D C:\PostgreSQL\data start
7) Might want to revert the MD5 -> Trust change later in the pg_hba.conf.
Update your pg_hba.conf file to allow for trusted local connections
[root#server] vim pg_hba.conf
>> local all all trust
then restart your PostgreSQL server
[user#machine] pg_ctl -D C:\PostgreSQL\data restart (Windows)
[root#server] service postgresql restart (Linux)
at this point you can connect to your server as postgres user using a local connection without the need to enter a password (omitting the -h parameter when calling the psql command will use a local connection - if you pass -h then this will match the line host all all 0.0.0.0/0 <method> in your pg_hba.conf file)
[root#server] psql -U postgres
You can then alter the postgres user role and set the password to whatever you like using the following command in the psql terminal
[psql] alter role postgres password <new_password>;
Once this is done you can restart your PostgreSQL server again
[user#machine] pg_ctl -D C:\PostgreSQL\data restart (Windows)
[root#server] service postgresql restart (Linux)
and at this point your password should be changed to the new password
I was having the same issue and I couldn't use Postgres in the CLI on my windows machine but I managed to trace down where the passwords were stored via
%APPDATA%\PostgreSQL\pgpass.conf
NB: You must have selected store password option when creating a server or database in the pgAdmin.
I hope this helps. Thanks.

Resources