Unable to query Presto database using Dbvisuallizer- Error Executing Query - mysql

We are trying to connect to presto using Dbvisualizer . and execute some queries . Catlog we are using is mysql .
Presto is installed in the linux server . presto cli is working fine in the linux . Started presto in linux .
Mysql is also installed in the linux machine . We are able to access mysql in windows using Dbvisualizer.
Created a mysql connector catalog for Presto. Successful in querying data of mysql using Presto-cli
as presto --server localhost:8080 --catalog mysql --schema tutorials
DBvisualizer is installed in the Windows machine . I'm able to access mysql and execute queries .
Presto also connected in Dbvisualizer . But we are unable to query data .
When we try to run a query . It is giving us Error Executing Query .
There is not much information available online , We dont know what we are missing here , Can Someone explain me the way to do this .
We need to execute queries from windows machine . we also tried from java code using jdbc jar . same exception
Added the Screenshot of Config.properties of the Presto Installation . Any property more to be added here?
. Any suggestion is appreciated . Thanks

It seems like you haven't installed any way to authenticate to use Presto. The authentication that exists on your MySQL instance is not used to authenticate users that access your Presto cluster.
There is a critical security vulnerability in Presto where "authenticated users can bypass authorization checks by directly accessing internal APIs". This has only been resolved in the Trino (formerly PrestoSQL) distribution so I recommend you use Trino if you plan on running a secured cluster in production.
Your options on Trino are, LDAP authenticator, Password authenticator, and Kerberos authenticator (don't recommend unless you already use Kerberos). Configure these first before trying to use SSL/TLS on your server.
You can also find help you with any further questions for setting up a secure cluster on the Trino slack channel.

Related

How do I connect my Android Application to a MySQL database stored in a server?

Background on the MySQL database: it was created from a Wordpress website. As far as I know, it can only be accessed through PuTTy with the ff credentials given to me by my client who I’m making the app for:
hostname
port
my username to get into server
my password to
get into server
mysql username
mysql password
It says from multiple sites that this is the PHP syntax to connect Android to MySQL
// Connecting to mysql database
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
It does not work and when checked for the connection error, it shows the error “Connection timed out.” when I put credentials needed (hostname, mysql
username and password). I’m assuming it’s because I need to get into the server first (with credentials #3 and #4).
Is there a workaround to this?
EDIT:
This is only based on the assumption that I am supposed to create a PHP file (that I will place inside a Jave file in Android Studio) to connect to their database. Are there other ways to connect to a private server?
Welcome Ateshi!
It sounds like you want an android app to directly access the mysql database that holds the content of a wordpress website.
The MySQL database server is most likely not publicly available on the internet for good reasons (security), as per this answer
You have posted some PHP code. PHP usually runs on the server alongside mysql, it not usually run on android.
Here is how you usually set up something like this:
Your android app makes a web request to http://yourexampleserver.com/example.php
Inside that example.php which is on the server, you have the PHP code that then does:
connects to mysql (with local credentials)
perhaps writes to the database
perhaps queries the database
formats the results into a useful format like JSON
The results are returned to java on your android which then usually shows them in the UI etc
This whole process is usually described as building a "webservice" for the app to use.
If however, you want the database contents to be stored offline and locally on android, then you probably need to connect to the server manually, export the database and download it, and then include it in your android project.

Cannot connect to MySQL docker instance via DataGrip application

I have managed to successfully connect to a docker instance running MySQL via the mysql command line utility. However, I am struggling to do so via DataGrip application from JetBrains.
My mysql cli command is as follows:
mysql -h127.0.0.1 --port=8181 -uroot
The connection string that is generated in DataGrip is:
jdbc:mysql://127.0.0.1:8181
The error I am getting from DataGrip interface is:
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Is there anything that need to change in DataGrip that I am missing. I have read that the connection has to also be done via TCP. Not sure how to check that DataGrip is doing that.
Update: I eventually found the problem was the docker container I was using. It seems DataGrip is not able to connect to version 8.0.1 (mysql:8.0.1) mysql docker container. I tested using version 5.7 of the container and could successfully connect.
I was having an issue connecting MySQL 8.0.3 using DataGrip. You need to download the JDBC driver from Oracle website. Select Developer Releases (Since this is an unstable version). The 8.0.8 version worked for me. Download and save in a project folder or something similar on your computer. You will gonna need it later.
Go to DataGrip: File > DataSources. Click on the + and select Driver:
Screenshot of the Step above
On the section Driver Files > Additional files click on the + and select the jar file you just downloaded
After that on the Class dropdown select com.mysql.jdbc.Driver
Mark Dialect as MySQL
On the section URL templates, put the Name as default and Template as jdbc:mysql://{host::localhost}?[:{port::3306}][/{database}?][\?<&,user={user},password={password},{:identifier}={:identifier}>]
Click on apply
Done!
Screenshot of MySQL 8.0.3 running on Datagrip
Add a new datasource using the new driver.
If you find the following error:
[01S00] The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support
You can do a temporary fix going to the Advanced tab and setting the serverTimezone variable for UTC as an example.
There are no *.jar-files anymore. Only *.deb-packages for my OS on the Oracle site https://dev.mysql.com/downloads/connector/j/5.1.html
So I selected driver Amazon Aurora MySQL for my MySQL 8.0.3 in docker.
It works!

Using SSL with command-line Flywaydb ( flyway ) to deploy DB changes

I'm working on a proof of concept to deploy using flyway's command-line tool from a centralized server to deploy to multiple database platforms. (MySQL, Postgres, and SQL Server)
I'm able to deploy successfully without SSL, however it is using unencrypted host information such as logins/passwords/ports to the destination Database Server. My concern is there's a chance the un-encrypted traffic could be seen.
Does anyone have experience with the flyway command line tool using SSL to deploy to:
MySQL
SQL Server
I did not see any information in the documentation unless I missed it.
Thanks for any help and suggestions!
In the flyway examples in flyway.conf it shows how to add additional values to the jdbc url for example
# MySQL : jdbc:mysql://<host>:<port>/<database>?<key1>=<value1>&<key2>=<value2>...
# PostgreSQL : jdbc:postgresql://<host>:<port>/<database>?<key1>=<value1>&<key2>=<value2>...
# Redshift : jdbc:postgresql://<host>:<port>/<database>?<key1>=<value1>&<key2>=<value2>...
So for Redshift/Postgres for example you can include the ssl=true flag
flyway.url=jdbc:postgresql://yourserver:5439/dbname?ssl=true
You need to add the public key that the DB server key was signed with to your hosts trust store (for Redshift see http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-ssl-support.html for details on that), e.g
${JAVA_HOME}/bin/keytool -keystore ${JAVA_HOME}/lib/security/cacerts -import -alias <alias> -file <certificate_filename>
I then had to hack the flyway startup script /flyway to include the truststore and password in the JAVA_ARGS (it probably should have these as variables) e.g
JAVA_ARGS="-Djava.security.egd=file:/dev/../dev/urandom -Djavax.net.ssl.trustStore=/etc/pki/java/cacerts -Djavax.net.ssl.trustStorePassword=changeit"
For MySQL I used the following URL to connect using SSL.
jdbc:mysql://hostname:3306/wpastudy?useSSL=true
Note the useSSL=true parameter.

Unable to connect to SQLEXPRESS using machinename

I am able to connect to SQL EXPRESS USING local but I am unable to connect using machine name. I wanted to test remote connection . I tried to restart the services but it is not helping .
It gives error 26
Also, if I use the pc-name using windows authentication it works fine but if I use SQL Server authentication it fails with error 18456 . So it looks to be issue with specific user which works fine with local but not with pc-name while doing SQL Server Authentication ( I have already checked and confirmed that both windows and sql server authentication is enabled )
Any suggestions ?
It seems to be issue with user properties. It is fixed now . Thanks.

PHP 5.2 based app unable to connect to Google Cloud SQL

We have a PHP 5.2 based app which we migrated to GCE, and encountered the problem where the Mysqli client does not work.
We used Atomic Archive repo to install PHP 5.2 on GCE 6 CentOS 6:
http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/
and also installed the provided Mysql client:
mysql-5.5.40-26.el6.art.x86_64.rpm
Following testing, the application fails with following error:
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2003): Can't connect to MySQL server on XXX.XXX.XXX.XXX
While the command line mysql client works just fine.
While looking at the mysqli.so PHP extension, we noticed it uses the oldest available MySQL library: /usr/lib64/mysql/libmysqlclient.so.16
Any chance that this library doesn't work with Google Cloud SQL?
This is how I connect from my php:
$conn = mysqli_connect("<IP>", "<username>", "<password>","database") or die ("Error" . mysqli_error($conn));