MySQL remote connection to Linux - mysql

Do I have to install MySQL on Windows to be able to connect to a MySQL server running on Linux and edit the files from windows ? Because I was installing the Workbench for SQL (I'm using MySQL Workbench Guide, Source: MySQL Workbench), then allow access to Linux (vps) from my pc, when I tried to install it, I'm stuck in the Windows config settings. Can someone help? (Screenshot provided.)
1 more thing: the program said "installing wmi" then "Could not set up connection: Could not connect to target machine."

you can install only workbench in windows without installing mysql server but you need to create a user on linux mysql server, who can then access it from the windows machine:
CREATE USER 'newuser'#'IP of the windows machine' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'IP of the windows machine';
FLUSH PRIVILEGES;
if you want the user to access regardless IP then you can use '%' instead of IP

Related

Ubuntu - xampp - could not import database to mysql

I have a project which needs to be run on PHP 5.5. I created a virtual machine with Ubuntu. I have windows 10 on my machine. I could not found version of lamp supporting PHP 5.5, so I installed Xampp. It works and also phpmyadmin works. But when I try to import database from command line, it says - "The program 'mysql' can be found in the following packages......". It asks to install the package.
The client wants to stick to the current PHP version, until we are up and live with latest versions of PHP.
Do I need to install mysql package separately? Is it possible to use it with Xampp ?
Or can I connect to the database on host (windows 10) ?
I tried to remove the mysql related files and folders, but due to file permissions, I could not remove all. With less time in hand, I tried to connect to the host database (xampp installed on windows 10), and it worked.
Here is what I did -
Run ipconfig (My host is windows 10).
Note the IPv4 address, under "Ethernet adapter Ethernet:".
Run following queries on host database (xampp installed on windows 10) -
CREATE USER 'yourusername'#'IPv4 address:port' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON . TO 'yourusername'#'IPv4 address:port' WITH GRANT OPTION;
CREATE USER 'yourusername'#'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON . TO 'yourusername'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
I used port 3306.
While connecting, I used the IPv4 address:port as host, username = yourusername and password=password.
I hope this helps somebody.

Accessing MySQL database server from Workbench on remote workstation

I installed a MySQL database server on Centos 7 on a machine with local IP address 192.168.1.40. I run all the post installation checks to make sure that the database is up and running. (It is)
I then installed MySQL Workbench on a second Windows machine (ip address 192.168.1.3) on the same local network.
It is my understanding that remote connection to a mysql database are disabled so I run on the database the command
GRANT ALL PRIVILEGES ON *.* TO 'root'#'192.168.1.3' IDENTIFIED BY 'password' WITH GRANT OPTION;
then I added to the /etc/my.cnf the string
bind-address=0.0.0.0
and restarted the server
Trying to connect from the remote workbench to the server i get the error
Did I miss something?

How can I connect to MySQL from NetBeans

NetBeans is installed on my pc.
I installed mysql on the raspberry pi using sudo apt-get install mysql-server.
To connect to the database from NetBeans I use the
New connection wizard
where I select
MySQL(Connector/J driver)
I leave it all as it is except the password. In the password I write the one that MYSQL prompt me to enter when it was installing.
When I press "Test Connection" I get "Cannot establish a connection to ...".
Did I miss something to install on the raspberry pi?
I am using a static IP address(inet addr).
My PI and pc are in the same network.
You need to set permissions in mysql:
GRANT ALL PRIVILEGES ON mydb.* TO 'root'#'%' WITH GRANT OPTION;
This will allow remote connections to access the database. You also need to change the listening interface in the /etc/my.cnf file. Look for bind-address 127.0.0.1. Change this to the ip address of your pi.
Just because you installed the mySQL-server package does not mean you have created a database yet. The easiest would be to SSH to your pi and use the command line to create one, or alternatively you can use mySQL workbench from your pc assuming you started the daemon on your pi. You will need to name your database and the name will be part of the URL you use to connect to it via NetBeans. You also may need to enable outside connections to mySQL. You may also need to download the JDBC driver for mySQL either manually or through NetBeans.

How to access mysql from ubuntu in vmware

I have MySQL installed in a Windows pc and have Ubuntu installed in VMWARE.
When I am trying to access MySQL through a hibernate application in Ubuntu I am getting the following error : Host 'HOSTNAME' is not allowed to connect to this MySQL server
. What configuration changes do I need to make to access MySQL server?
You have to GRANT access to your remote user/host. See the manual or this article.
The GRANT syntax is here.
HTH.

MySQL - ODBC connect fails, Workbench connect works

I am trying to install and test a MySQL ODBC Connector on my machine (Windows 7) to connect to a remote MySQL DB server, but, when I configure and test the connection, I keep getting the following error:
Connection Failed
[MySQL][ODBC 5.3(w) Driver]Access denied for user 'root'#'(my host)' (using password: YES):
The problem is, I can connect with MySQL Workbench (remotely - from my local machine to the remote server) just fine. I have read this FAQ extensively but it's not helping out. I have tried:
Checking if mysql is running on the server (it is. I even tried restarting it many times);
Checking if the port is listening for connection on the remote server. It is.
Connecting to the remote server using MySQL Workbench. It works.
Checking if the IP address and Ports of the remote database are correct;
Checking if the user (root) and password are correct;
Re-entering the password on the ODBC config window;
Checking and modifying the contents of the "my.conf" on the remote server to allow connections from all sides (0.0.0.0);
Including (my host) on the GRANT HOST tables from mySQL (I also tried the wildcard '%' but it's the same as nothing);
Running a FLUSH HOSTS; And FLUSH PRIVILEGES; command on the remote mySQL server to reset the privilege cache;
Turning off my Firewall during the configuration of the ODBC driver;
Checked if the MySQL variable 'skip_networking' is OFF in order to allow remote connections.
What is frustrating is that I can connect with MySQL Workbench on my local machine (with the same IP/user/password), just not with ODBC.
What could I be doing wrong, or what could be messing up my attempt to connect with ODBC?
Update: I managed to set up the ODBC driver and get it running correctly on the server side. I can connect there to the localhost using a command line (with the "isql" command). But I still can't connect over remotely with my Windows 7 machine.
Solved.
As it turns out, it was a permissions problem. I ran the following command on the remote server SQL:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'(my_host)' IDENTIFIED BY '(my_password)';
I had run the previous command, but without the "IDENTIFIED BY" password. Then, to reset the mysql permissions cache, I also ran
FLUSH PRIVILEGES;
And now it works.
Worked for me too only with 64bit odbc driver not for mySQL 32 bit.
We had a similar case that 'user'#'%' was granted at server but ODBC connect failed at a PC while workbench connect successfully.
MariaDB 10.0.31,
MySQL ODBC 3.51,
MySQL Workbench 8.0
Solved by install MariaDB Connector/ODBC 3.1 instead of the MySQL ODBC (https://downloads.mariadb.org/connector-odbc/).