Excel VBA to connect to MySQL on linux server - mysql

I am trying to connect to MySQL database using VBA from my local machine. The database is in the linux server(XXXX.xxx.edu). I have the SSH client in my machine through which I connect to the *****.xxx.edu server. Once when I login and use the below command, I am able to access the MySQL database without any problem.
mysql -p -h XXXX.XXX.edu -u username dbname
However,I need to run the VBA in my machine and insert the values into this database. I tried to connect using the code mentioned in the below link.
Error in VBA:`[Microsoft][ODBC Manager] Data source name not found and no default driver specified
As told in the suggestion of the above link, I installed the MYSQL ODBC drivers which installed the MySQL 5.5 in my machine. Even after installing, I get the error,
[Microsoft][ODBC Manager] Data source name not found and no default driver specified
I am not able to figure out what exactly is the problem. How should I connect to the linux server and then connect to the MySQL database?

you install the mysql odbc driver (the msi) from here.
http://dev.mysql.com/downloads/connector/odbc/
you run ODBC Data Source Administrator
go to System DSN
click Add
select, for instance, MySql ODBC Unicode Driver
click finish.
dns name: fred
description: fred
tcpip server: 192.168.1.11 (whatever, dns, so long as u can point to it)
port 3306
user: root (whatever)
pwd: whatever works
drop down database, click test or view them

Related

Remote MySql Database CPanel

I want to connect a remote MySql database from MySql workbench but I got an error:
"IO Error: [Errno None] Unable to connect to port 22 on or
xx.xx.xx.xx"
What should I do?
I already add my IP to remote host
when I delete IP that makes the error, then I'm trying to connect, that IP showed up again in my remote host
So how can I connect to my database from MySQLWorkbench?
How to Connect to a Database with MySQL Workbench
One tool you can use to connect to remotely connect to databases on your shared, VPS, or Dedicated hosting account is MySQL Workbench. MySQL Workbench is a free tool you can use to connect to your server databases from your personal computer. MySQL Workbench can be Downloaded for free at the following link:
http://dev.mysql.com/downloads/workbench/
You will want to use the Windows (x86, 32-bit), MSI Installer if you are on Windows. The file we are installing in this tutorial is the mysql-workbench-gpl-5.2.47-win32.msi file.
Once you have downloaded MySQL Workbench, you can install it onto your computer. After you have the program installed, follow the steps below to set up a remote connection.
Add IP to your Remote MySQL
In order for you to be able to connect to your databases remotely you will need to add your local computer IP address to the Remote MySQL in cPanel.
Steps to connect to your database remotely
Open MySQL Workbench.
Click New Connection towards the bottom left of MySQL Workbench.
In the "Set up a New Connection Dialogue" box, Type your Database
connection credentials.
The credentials will be like the following:
Connection Name: You can name this whatever you like.
Connection Method: Standard (TCP/IP).
Hostname: You can use your domain our your cPanel IP address.
Port: 3306
Username: Your cPanel username or the user you created for the
database.
Password: cPanel password or the password for the database user that
was created.
Default Schema: This can be left blank.
Click Test Connection.
Type your password and click the "Save Password in Vault" check box.
Click Ok.
MySQL Workbench should say "Connection parameters are correct". Click Ok.
Click Ok again to accept the connection settings.
Now under the SQL Development section you will see your connection listed in the Open Connection to Start Querying box. Click your newly created account.
Now you will see the databases list in the area on the left.

how to connect mysql workbench to hostinger database

I am working on database project, my database is on hostinger. I want to connect mysql workbench to hostinger.
can please someone guide me how to do this.
In cpanel:
Add remote IP Address to Remote MySQL
In Operating System: ODBC and MySQL Workbench
Close MySQL Workbench
Download and Install 32-bit or 64-bit MySQL ODBC connector from MySQL website
Restart PC
Configure ODBC (Windows run Win+R: %windir%\System32\odbcad32.exe )
Add source and choose: MySQL ODBC 5.3 Unicode Driver
Choose Data Source Name
TCP/IP Server: mysql.hostinger.[top-level domain] (e.g. mysql.hostinger.nl or mysql.hostinger.in)
!!! or Public IP address if it's given in cpanel at Remote MySQL on top of the page.
Port: 3306
Fill in: User and Password
Test connection
Start MySQL Workbench
Fill in same data as ODBC connection and test connection.
First SQL command have to be: USE [database name] ;
show tables;
Go to your hpanel
Select your website hosting click Manage
Go to Bottom page Under Database's click Remote MySQL
Check Any Host and Select your Database cick Create
Copy the hostname(which is something like sqlxxx.main-hosting.xx or IP 19x.xxx.xx.xx) located on top of IPv type Field
Goto workbench:
Create New Connection
Connection Method Standard(TCP/IP)
Under Parameters tab Hostname Field Enter Copied Hostname(sqlxxx.main-hosting.xx or IP 19x.xxx.xx.xx)
Port Field Enter:3306
Enter the Username & Password credentials when you created your database in Hostinger

Ole db connector for Mysql

I have remote machine with ip 192.X.X.X and am connecting it using putty(SSH) after login i was connecting to mysql using local host 127.0.0.1 and its working fine.
I was also able to mysql using mysql work bench using the option standard tcp/ip over SSH
currently am using SSIS 2012 is there any way we can connect to this mysql(which is in remote machine) using any connector..I tried oledb and odbc but not able to connect
Can any one help me on this...
Thanks in advance...
Here is how to connect to a mysql database (on a different server) for use with an SSIS 2012 package using an SSH session.
First, install the mysql drivers if not already. They can be found here:
mysql official drivers
Set up your SSH session.
Set up port forwarding. Either do a remote forward (Set local_port: 3306, remote_host: yourmysqlservername_or_ip, remote_port: 3306 ) or a local forward (Set port: 3306, host: localhost, remote port: 3306).
Log in to your server with the SSH session you just created.
The preceding 3 steps taken from this link about using SSH with mySQL
Next, you will set up a data source (system DSN) from within the ODBC data source administrator (Installed along with the drivers hopefully, example shown in the following link). This data source is what will then show up in your Connection manager list in SSIS. During this setup, you will put in 'localhost' as the server name rather than the actual server name, since you are using an SSH session and port forwarding.
Example DSN sestup
Finally, when you create a new connection in your SSIS package, choose an odbc connection and the data source name you just set up should show up in the list of data source names.

mySQL command line works but ODBC and workbench do not

I am trying to test a connection to a mySQL database running on a remote linux server. I am running Windows 7 and have mySQL installed on my machine as well as the 32-bit ODBC driver. I can connect from the DOS command prompt with no problems. But I cannot connect using mySQL workbench or with ODBC (from MS Access).
In MySQL workbench my error is:
Your connection attempt failed for user 'username' from your host to server at 'x.x.x.x:x': Unknown MySQL server host 'x.x.x.x' (0)
In MS Acess (ODBC driver) my error is:
Connection faile:[HY000][MySQL][ODBC 5.2(w) Driver]Can't connect to MySQL server on 'x.x.x.x' (10061)
I've searched stackoverflow extensively and I found lots of people who can't get ANY connection to work. But I know I can log in from my computer. Could it be something other than ports?
Please make sure you are using correct ip address in MySQL workbench to connect to your mysql database

how do i connect to mysql database in Linux server through windows machine

I have a MYSQL in windows that needs to connect with MYSQL in Linux server.but I want to know is there any way to connect MYSQL in Linux server without having MYSQL in windows.
Follow the following instructions:
1. Open Terminal and type in : sudo apt-get install putty
2. Click Y on subsequent messages that appear and let the installation complete.
To use Putty, go to Menu > Internet > Putty SSH client
To connect to a remote server that supports ssh login , enter the host name or the IP address of the remote host, in case you need to frequently need to login to this server , save the session by naming it something nice.
If the connection is initiated for the first time or if the server hardware configuration has changed, you may see the message. This is to ensure that you are logging in only to the trusted server that you know and not something else.Accept that.
Finally, enter user name and password to login to the server remotely, if all goes well you will see the terminal on the remote end.
connect to mysql :
type mysql -u username -p password
You can use putty software. Here is the link to download.
You can use putty for connecting mysql.
Connection string will like this
mysql -uDBUSER -pDBPASSWORD DBNAME -hHOST-IP
Or you can also use navicat or sql yog software to connect mysql on linux system on remote.