I have set up a MySQL server on Debian Linux and need to access a database on this server via vb.net. I found some help on Code Project to download the connector.net library and build a class to access the MySQL database. However when I try to connect I get the authentication error below when attempting to establish a connection with the mysql server:
Authentication to host '192.168.68.47' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'#'' (using password: YES)"} System.Exception
It seems that the library is appending the Windows workstation and domain to the user name and I am getting error. I tried using the root user with "#IPaddress" of the workstation, but it simply appended the workstation name and domain to this user. I also tried with another user besides root.
This is perfectly logic, because on your mysql server you need to Grant access to your host so it will be allowed to connect to, you can do it by following instructions in the following
Link
Also in the mysql configuration file, in your case : /etc/mysql/my.cnf you need to delete the line
bind-address = 127.0.0.1
This line will restrict all access from remote hosts, deleting it will allow access from remote hose which is what you want to do.
Hope this helps.
Related
So I am attempting to use MySQL workbench to connect to a database in the cloud on AWS RDS services.
When I attempt to connect I get an error like this.
Access denied for user 'admin'#'ip_octet1-octet2-octet3-octet4.res.spectrum.com' to database 'default_database'
I have the database set as publicly accessible and all IPS are able to connect. The problem seems to be my client is attempting to try to connect via hostname. I have tried multiple different clients, so it seems to be an issue with AWS or my ISP. I have been able to shell into MySQL instance from other EC2 instances.
Any suggestions would be appreciated.
Your mysql user permissions should allow connecting from the particular host. you can grant permission to the existing user as below.
GRANT ALL PRIVILEGES ON database_name.* TO 'admin'#'ip_octet1-octet2-octet3-octet4.res.spectrum.com';
Reference:
Create and Grant Mysql Permissions
Based on the error you are getting, this doesn't seem to be an issue with reaching the server, as the message complains about an access denied, otherwise it would state it can't reach the host. I would go for the password route, as the admin user should get created with '%' for host. Was it a snapshot? Or created from scratch? If so, was the password properly set? If it is from scratch, you can always delete it and create it again.
Regards!
I have a MySQL server (v8.0) running on windows server 2016. I also have IIS running and PHPMyAdmin installed. In addition to this, I have a PHP web application which runs on the same server (under IIS) which accesses the MySQL database. Finally, I have several Python scripts which access the MySQL database.
Somehow, I have lost the ability to access the database from the Python scripts, but the web application still works and PHPMyAdmin can see and modify the database.
Even more strangely, I can no longer user MySQL Workbench to access the server from a PC on the local network, and PHPMyAdmin cannot access the users table of the mysql database. I can't change user details at all through PHPMyAdmin, I get the error:
Error in processing request
Error code: 500
Error text: Internal Server Error (rejected)
It seems that the connection to server has been lost.
MySQL Workbench gives me this error:
Your connection attempt failed for user 'user' to the MySQL server at SERVERADDRESS:PORT:
Access denied for user 'user'#'SERVERADDRESS' (using password: YES)
I have checked that the server can accept connections from remote computers by adding bind-address=0.0.0.0 to the my.ini file. I have also checked to ensure that 3306 is allowed through the firewall.
Any ideas on what could be causing this issue?
ADyson and MrApnea pointed me in the right direction.
The problem was caused by my main database user having the host reset from % to localhost, I'm not sure how this happened or when. As the app was running locally, this was not affected, but all other access was denied (including MySQL workbench). My root user is set to local only for security.
To fix this, I connected to the server via RDP and logged in to the console as the root user. I then ran these commands to see the error:
use mysql;
select host, user from user;
This showed me that the main user account had "localhost" in the host. I ran this command to update this user:
update user set host='%' where user='username' and host='localhost'; flush privileges;
I have created a free application using openshift, and created MySQL and phpmyadmin cartridges and inside my phpmyadmin I have gave access to all users from anywhere with all privileges now the problem is when I try to connect from my local MySQL workbench i get connected but I don't see my tables I have created in remote server using phpmyadmin and I can't do any action at all like creating schemas or tables where i get
ERROR 1044: Access denied for user ''#'localhost'
Remember that I allowed all privileges for any user, but I still get access denied for any action except only for the database connection.
Make sure the user you've given full permissions to is the same user MySQL Workbench is connecting as -- there's a difference between the hosts % and localhost for instance. From MySQL Workbench, issue the "Status" command and compare the username and host against what you've configured.
You're apparently connecting through 'localhost' so you have to give full permissions to the anonymous user with host localhost (or change your connection type to tcp so that your connection is via 127.0.0.1 instead of localhost).
Edit for further clarification: The MySQL permission structure treats different types of connections differently; a client connecting via TCP connection always appears to come from an IP address, even if it's from the "local host" (in the sense of being on the same machine), in which case that IP address of the incoming connection may be 127.0.0.1. Socket type connections are registered in MySQL as coming from the host "localhost" (literally, in this case). This is why we're verifying which host MySQL Workbench is connecting as.
Different connection types appear differently to MYSQL even if they're coming from the same "local machine." Furthermore, the wildcard host does not include 'localhost' socket connections, those are a separate entry in the permissions field with the 'localhost' host name; the wildcard does not apply, as I explained above. This is the reason why we're checking which permissions you set against what MySQL Workbench is connecting as; it's the most common cause of difficulties such as these.
I have a phpMyAdmin with MySQL on a linux remote machine to which I can connect with no problem with a browser.
But when I am trying to connect a DB in MySQL from a .NET program in my machine, I am getting an error message:
Authentication to host 'theIpNumber' for user 'newUserName' using method 'mysql_native_password' failed with message: Access denied for user 'newUserName'#'myMachineName' (using password: YES)
I tried to configured it like it is explained here: http://www.devside.net/wamp-server/accessing-mysql-or-phpmyadmin-from-outside
creating a new user with password in phpMyAdmin and changing the config.inc.php
Then in my app.config I have the connection string with:
connectionString="server=theIpNumber;UserId=newUserName;Password=newUserPassword;database=theDB"
But I am still getting the same error message when I run my program. Any idea how to solve this?
Finally I solved it adding in phpMyAdmin another user with the same name "newUserName" and password, and with the host value "%"
I am trying to connect to a MySQL database server (remote), but I can't. I am using an user with grant privileges (not root user). The error message is the following:
Can't obtain database list from the server.
Access denied for user 'myuser'#'mypcname' (using password: YES)
"myuser" is an user I created with grant access. This user allows me to connect locally to every database. I am using the same software versions in both hosts: MySQL Server 4.1 (server) and EMS SQL Manager 2005 for MySQL, edition 3.7.0.1 (client).
The point is that I need to connect to the remote server using a different user, not root user. So, how to make the connection?
Thanks.
You have to make sure that the remote user account matches what the server will see coming in for a connection. For instance:
grant select on dbname.* to myname#mypc;
will not work if mypc is not resolvable on the server via DNS or the hosts file. In this case, you could try either using an IP, or a FQDN:
grant select on dbname.* to myname#10.1.2.3;
grant select on dbname.* to myname#mypc.example.com;
Look in connectionstrings.com to see if you have the right connection string used for MySql.
Make sure
that your MySQL server listens not only on localhost
your user can access the server from his location. Try 'myuser'#'%' in the GRANT command.
//EMS manager for mysql
//this magnificient tool provide you with a way to connect to such a server that prevents access to the server from any remote file or any way from outside world
//all you need is to have ftp access to the remote server
//in c:/program files/Ems/ you will find file called emsproxy.php
//it is what we call An (API) in programming world
//upload that file to your remote server
//then when you connect with EMS you select tunnling -->checkbox
//it will ask you on the next step to provide a full url of your emsproxy.php
//i tested that process myself. i did not have access to cpanel nieghter phpmyadmin
//thanks