Context: I have installed mysql-server on Ubuntu and was able to setup password for root account and also created a few accounts with all privileges. I was able to connect to any user or the root user using the usual
mysql -uroot -p
I enter my password and I connect to the databases.
Issue: I have a python flask application that uses SQLAlchemy to connect to the database using a username that I created, with a password. That user has all privileges. After I ran my application, I am UNABLE to connect to any user account from the terminal but the SQLAlchemy connection works fine via the flask application.
Fixes tried
- I tried restarting the mysql service.
- Turned off the flask application.
- I tried restarting the linux host.
I need to fix this issue and be able to connect to the mysql database from terminal as well as from the application (currently only application connects to the database).
-
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)Rookie_Coder2318– Rookie_Coder23182022年10月27日 06:48:54 +00:00Commented Oct 27, 2022 at 6:48
-
3Does this answer your question? Cannot reset MySQL default root password after initial installationmustaccio– mustaccio2022年10月27日 13:35:04 +00:00Commented Oct 27, 2022 at 13:35
-
After spending a few hours myself figured out that the issue is with users that had '@', in the password. For whatever reason the SQLAlchemy python library does not like that char in password so I created a new user without '@' in the password and that helped me connect with my python app. After that connection, all user passwords with @ in it refused to work, but the users without @ in the password still work just fine. Apparently SQLAlchemy messed up passwords for those accounts. Luckily I had this backup account that I created without @ which I will use to reset other account passwords.Rookie_Coder2318– Rookie_Coder23182022年10月27日 16:08:43 +00:00Commented Oct 27, 2022 at 16:08