I know that this is a fairly common error, but the curious thing is that in this case the credentials work when I'm logged in to Docker and working with mysql in the terminal. But when I try to use a client like DBeaver or MySQL Workbench, or even making an API call via Python, I get the error "Access denied for user 'root'#'localhost".
I thought it might be because I have another local MySQL database using port 3600, so I changed it to 3700 but the problem persists. I've made sure that the image is running in the Docker application, and besides, as mentioned, it works using the terminal. This is on MacOS Ventura. If there's any other information I can provide that would help, please let me know. Any assistance is appreciated!
Related
I'm creating new app on Heroku. Installed add-on "JawsDB Maria" successfully - I can open it's dashboard
In PHP on connection to DB I receive error:
SQLSTATE[HY000] [1044] Access denied for user 'vcgu1h273742rn5l'#'%' to database 'jeyx2j66ipgtqe11'
I'm sure that problem is not in PHP, because the same error I receive even on MariaDB dashboard trying to Create New Databite - https://prnt.sc/rj4dr4 .
Looks like solution is to GRANT ALL PRIVILEGES to user. But using dashboard I can't execute even SHOW GRANTS.
Questions:
Can somebody help how to solve this problem?
Or, at least, which way I can GRANT ALL PRIVILEGES?
I've tried:
read Heroku docs: JawsDB MySQL, PHP + DB
searching for similar problems in Heroku support, Google, SO:
the best match I found is here. But heroku pg:psql - it's tool only for PostgreSQL.
tried to find useful command for my case in Heroku CLI Commands
Additional info - I'm sure it is not important, but just in case it is:
project is based on Yii2
for easy deployment on Heroku installed "purrweb/yii2-heroku"
You probably know how to read your error message. At any rate, my superpower is explaining the obvious. So, ... here goes.
SQLSTATE[HY000] [1044] Access denied for user 'vcgu1h273742rn5l'#'%' to database 'jeyx2j66ipgtqe11'
Tells you your php program couldn't get to the MySQL server. That operation goes in these steps.
Make a TCP/IP network connection to the server. SUCCESS.
Present a user name and password to the server. SUCCESS.
But the server rejected those credentials. FAILURE
Access the database schema mentioned in the connect request. Not attempted yet. So we have no information about whether the named database actually exists.
The success of step 1 means there are no firewall or network-routing issues. That's good.
The success of step 2 gives us even more confidence about firewall issues.
The failure of step 3 tells us that we're not using a username and password that the MySQL server knows about.
Step 4 is incomplete. So, even if we fix the username and password issues, we still might get another issue before this mess is behind us.
Heroku assigns those usernames to their customers. So, check on the appropriate Heroku control panel to see whether you're using the right username / password credentials. Your error message says you've got wrong credentials.
Next step? Ask your vendor for help. Is Bruce Schneier is reading this? Maybe he can fix this for you from his earbuds while he's riding on the subway. But none of the rest of us here on SO can fix it.
I've waited for 8 hours, hoping there is some trigger, that will complete all necessary settings. But it didn't helped.
Then I reinstalled this add-on. And now all works fine!
So, that was some kind of "JawsDB Maria" bug.
I was following a Ruby on Rails tutorial (fairly new to this language) and suddenly started having some problems connecting with MySQL on my Mac. While doing the tutorial I believe I changed the shell location using similar steps in this guide, not sure if that’s important at all.
My $PATH returns:
-bash: /Users/[MYUSERNAME]/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin://usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory
Anyway, I’ve been working through the tutorial and have been developing since then but I went to check my files a week or so later and suddenly cannot connect to MySQL at all, if I enter mysql -u root -p (then enter correct password as it always has been) I get:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I’ve got MySQL Workbench although I rarely use it, and I use the System Preferences App to start and stop my server. I also have MAMP which I was using a while ago but I haven’t used it since using RoR.
Strange thing is, this happened before and I couldn’t connect, I was searching around for ages trying to find a solution and (not sure what I did, probably nothing substantial) it started working again. But once again it’s happened and think it’s time I learnt what the problem is so I don’t keep running into it.
Personally, I think I should’ve learnt MySQL in more depth before blind-following a tutorial assuming it’d be fine.
Any help would be greatly appreciated, thanks!
Let me know if you need me to provide anything else.
Simple answer in the end, I followed this tutorial and was able to reset the root password and it fixed everything.
I install some old app build in Rails 4.0.0 and ruby 1.9.3 gems. Everything goes ok but when I go to rails console and try for example wrote : User, to get database table it give me error:
Mysql2::Error: Access denied for user 'root'#'localhost' (using password: YES)
What is interesting, when I do:
sudo /etc/init.d/mysql stop
It says that database was stopped but app still working :)
Can somebody tell what is going on?
Well - if the database tells you it's stopped, and your app is still working I can think of 3 possible causes.
The database is still running, and you've been lied to
The app does not need a database to respond to the requests you make
The app is using a database elsewhere.
The most obvious way I can think of, it to have a look at config/database.yml, there you can see what database your app is connecting to, and the username/password. If it's not the one you've stopped - there's your answer.
If it is the one you've stopped, the try something like:
netstat -an | grep -i mysql
to see and the some ps -ef and kills (I'm a bit brutal) as required to bring it down.
otherwise, it may not actually using the database to serve the information you want. If information is hard coded in the controllers and view - it'll serve you just fine.
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
I keep getting the error 1045(28000) when trying the mysql -u user -p command. The same password works in the MySQL Command Line Client and the server is running according to Workbench and Notifier. Not sure if this is related, but the only odd thing is that Notifier shows that I have two things running, both named "MySQL56_1" and when I try to stop the one where I don't have the option to "Configure Instance" or open the "SQL Editor", I get the error saying that it was "not found in the Windows Services".
EDIT: still have not solved this, all of the commands mentioned here yield error 1045 with the variations of mentioning either 'user'#'localhost' or 'ODBC'#'localhost'
The error 1045(28000) denoted for Access Denied to the user..
You are using different connection parameters in sql editor and cmd..
Cross check your username, password, socket file path, hostname and reconnect via cmd.
Thanks
Ok, if anyone is interested, here what worked for me. In Workbench, on the bottom left hand corner, there will be all these "schemas" listed, click on any one (they all show the same parameters in my case at least) and, using all the relevant parameters specified under Information>Session, play around with the commands listed in this chapter . Basically what user Aman Aggarwal was talking about, just took me a while to understand how this cross checking is done exactly.