Connecting to remote MySQL Database

Discuss the database features

Connecting to remote MySQL Database

Postby w1177273@gmail.com » Wed May 05, 2021 6:38 pm

I am trying to connect to a remote MySQL database which I can access using PHP:

$con = new mysqli('localhost',"myuserid","mypassword","mydatabasename");

I assume I have to set up a connexion in Database. I then tried:
Connect to an existing database: MySQL
Next How do I want to connect? Tried ODBC.
Then it asked for the name of ODBC Source which I do not know.

Is there a simple guide to connecting to remove MySQL Databases?
OpenOffice 4.1.9 on Windows 10 Home
w1177273@gmail.com
 
Posts: 2
Joined: Wed May 05, 2021 6:11 pm

Re: Connecting to remote MySQL Database

Postby Villeroy » Wed May 05, 2021 7:12 pm

Install https://libreoffice.org/
File>New>Database...
Connect to existing database
Type: MySQL
[X] Connect directly (using the driver that is shipped with LibreOffice)
Enter database name, host, port, user name and check "Password required".
Click [Test Connection] and enter the password.
Register the database document if you need data in office documents (does not harm anyway).
Save the database document.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 30080
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Connecting to remote MySQL Database

Postby w1177273@gmail.com » Wed May 05, 2021 11:24 pm

Thank you . Libre Office seems to have simpler interface than Open Office as it has a direct connexion.
Unfortunately I get an error
Lost connection to MySQL server at 'handshake: reading initial communication packet', system error: 34
So it looks like I am closer. Do you have any suggestion?

When I first connected, it would not accept the URL or IP. It needed localhost. But to access remotely, I will need one of these. (They both give the same error.)
OpenOffice 4.1.9 on Windows 10 Home
w1177273@gmail.com
 
Posts: 2
Joined: Wed May 05, 2021 6:11 pm

Re: Connecting to remote MySQL Database

Postby Villeroy » Wed May 05, 2021 11:57 pm

Install Java and use JDBC with a JDBC driver for MySQL
Tools>Options>Advanced>Class Path... and point to mysql-connector-java.jar (that's the driver's file name on my system).

Restart office.

Create a database of type MySQL, then choose JDBC and when prompted for the driver class: com.mysql.jdbc.Driver
You can also create a database of type JDBC with a connection URL jdbc:mysql://localhost:3306/TESTDB and the same driver class.
I don't know how to handle ODBC on Windows. That would be the 4th variant how to connect a LibreOffice Base document to MySQL.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 30080
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Base

Who is online

Users browsing this forum: No registered users and 4 guests