Connecting to a remote mySql server from my local machine - mysql

My main problem right now is that I can't connect to the remote mysql server while developing on my machine. I'm trying to update a website that was previously developed by someone I do not know. I've been editing the site on my local machine but I need to access data from the mysql database that it has been using. I have the username and password that the site uses to connect to the mysql server. I can connect to it through phpmyadmin but I would like to work locally without publishing my edits to the server.
I found this here in SO and I tried running the scripts in phpmyadmin using my pc's IPaddress but I keep getting
Access denied for user 'username'#'localhost' (using password: YES)
even though I'm 100% sure I'm using the password that I used to login to phpmyadmin. I tried creating a new user but the login I'm using doesn't seem to have a Create User privilege either.
I understand that the previous developer might have a different "admin" account that has all the privileges but I have no way of knowing either.
I am a C# developer but I'm really new to MySql. Any help is greatly appreciated.

This may be a firewall issue. phpmyadmin listens on port 80 by default, but mySQL listens on port 3306. Please check the firewalls on your local PC (to make sure you can get out on 3306) and the server (to make sure you can get in on 3306).

Related

How to connect Power BI Desktop to remote MySql server that requires authentication

I have a MySql database running on a remote server which requires ssh authentication that I need to connect to with Microsoft Power BI. I can easily connect to MySQL on my localhost machine, but cannot find a way to manage both the server ssh authentication and the database user log on information.
The server requires authentication on port 22 with a username and password and the MySQL database requires a different username and password.
Can anyone offer assistance?
It seems possible to connect remotely, though I'm not sure you can do it through an 'SSH tunnel' on port 22.
There's a discussion here about connecting remotely which sounds to me like a connection to the usual port 3306, though I'm not certain:
https://community.powerbi.com/t5/Integrations-with-Files-and/Cannot-Connect-to-MySQL-on-Linux-VM/td-p/94914
Some common pitfalls:
1) Make sure you download the correct version of MySQL/Net connector. As of now, version 6.6.5 seems to be working. I wasted a lot of time trying to figure out what was wrong with earlier versions.
2) Server & database settings: closed ports / user permissions / bind-address
Before connecting PowerBI, try to connect another utility like MySQL Workbench. This will force you to troubleshoot the above settings.
This is not currently possible with PowerBI. The feature is currently under review, and you can help get it prioritized by upvoting here:
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/7020353-mysql-over-ssh-connection
I don't think it is supported (yet) but it looks like a lot of people want a solution including me. See this Power BI Ideas Request
1) create gateway to connect server then
2) then it will ask connection string their you can give server port and database username and password
The problem turned out to be an error in the remote servers firewall configuration.
After further research I have confirmed that Power BI would not support dual authentication steps like logging onto a remote server with ssh and then connecting to the database. Thanks Robin for your suggestion. That was a key point.
Please remember that for remote connections you need to authorise the mysql users to connect from specific hosts (adding the IP) or % to allow to get connected from any host remotely
the SQL is something similar to:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
How to allow remote connection to mysql

How to access my newly setup MySQL database (getting "Domain is currently unable to handle this request.")

I just set up a new MySQL database with the MySQL workbench & created a user for it with all necessary privileges. I am using this database for use with my php code. But I can't seem to connect to it on my live server (pages are hosted on windows server 2012). Everything works fine in my local environment with xampp and the new MySQL database is exactly the same as the xampp one. I think I am maybe using the wrong host name or something. As host name I copied the name that is displayed after "Host:" when you click on Server Status in MySQL workbench. The database name, user & password should all be correct. But when my code tries to access the db I get a "The domain page isn’t working. Domain is currently unable to handle this request."
You either have no network connection to the server at all or it is blocked due to firewall or routing misconfiguration.
If you do have network access in general, you might forgot to
FLUSH PRIVILEGES;
or you have not enabled networking over TCP, the default is to listen only to localhost (on unix systems via unix sockets, on microsoft I guess it's simply TCP).
Read about the following configuration parameter which will solve your networking issue:
bind-address
If you have a very old MySQL server version, the parameter is enable-networking but it shouldn't be the case anymore.

Amazon EC2 Tomcat7 instance unable to access MySQL db on same system

I think I've seen a variety of similar posts on this topic, but am still unable to resolve my issue, so I figured I'd post with my specifics.
I have an Amazon AWS Linux EC2 instance running Tomcat7 web server. On the same machine I am also running a MySQL5 server, but I am unable to get the Tomcat app to talk to the MySQL database.
My Java app on tomcat tries to connect to MySQL by reading from a properties file:
jdbc.mysql.host.path=jdbc:mysql://localhost/
jdbc.mysql.schema=prod
jdbc.mysql.username=root
jdbc.mysql.password=<password>
I am accessing the app from another system via web browser, but when the app tries to connect to the database I get the following error in catalina.out:
java.sql.SQLException: Access denied for user 'root'#'localhost' (using password: YES)
I'm pretty sure the issue has to do with permissions and communication between Tomcat and MySQL, because I've written a simple java program utilizing the same code to read the same properties file, and the connection is made successfully.
Here are some things I have attempted to remedy the issue:
change the owner of the properties file (currently owned by 'Tomcat')
ensured that user 'root' has been granted all privileges in MySQL
ensured that port 3306 (MySQL default port) is accessible by my test server
updated iptables made various modifications to /etc/my.cnf file
(tried to bind ip, but that didn't work)
I have a hunch that the issue may be related to the fact that I am trying to access the MySQL database using user 'root'. Even though I'm accessing it via localhost, the system may not support this because MySQL treats this as access from a separate host and (maybe?) root access from other hosts isn't allowed?
Any suggestions on things to try would be greatly appreciated...
I believe the issue was a combination of things.
Here are some items to consider that ultimately fixed it for me:
- making sure you were accessing the correct app via browser (I was using ROOT app, but trying to connect to another one)
- making sure a user exists in MySQL using 'Create User ....'
- making sure all privileges are granted on the database in question, for some reason granting all privileges on . wasn't working for me

Connect to database using Workbench

I have a database on my server and I want to connect to it through MySql Workbench, I entered my HostName, Username, Password, When I click Test Connection I get this Error Message:
Failed to Connect to MYSQL at **.**.***.**:3306 with user root.
Host '**.171.199.66' is not allowed to connect to this MySQL server
I am 100% sure my Hostname, username and Password are correct, I did some research and from what I managed to find out that I have to actually permit an access from my IP address to the database before I can connect.....if this is correct could someone explain to me how to give myself e permission to connect to my database on server.
It is likely that your MySql root account is configured to not accept remote root logins (its a default). If you are trying to connect from anywhere but localhost its not going to allow it. Your're right you need to permit access for your IP. You need to do it from within the server your MySql is installed on. In case of if you have managed hosting, your hosting company should provide you with a tool like phpMyAdmin or such, to manage your MySql. If it is your own installation, you can connect to mysql server instance from the console and go from there.
Check out another stackoverflow post:
Here is what you should be looking for in phpMyAdmin:
Keep in mind it might look a bit different depending on the phpMyAdmin Version.

Using a remote MySQL database for a WP install on localhost

I am trying to use a database on my SiteGround hosting account for a WP install on my localhost (where I have Apache, PHP running using DesktopServer).
I am using the IP given in Remote MySQL section of cPanel for DB_HOST. I have whitelisted my IP. Also double checked to ensure that DB_NAME, DB_USER and DB_PASSWORD are correct. Gave full permissions to the user to access that database.
When I visit the WP install page, http://local.dev/wp-admin/install.php it says "Error establishing a database connection".
I sent a support ticket to the host and they concluded that everything is fine from their end:
I added a test IP of mine to cPanel > Remote MySQL and connected successfully to your database using the credentials shown on your screen shot...Everything seems properly and you should be able to connect remotely, so if you cannot connect your local app, I suppose that there is some local issue.
Can anyone give a clue as to how I can troubleshoot this?
I am using a Mac.