Username Failures When Connecting SQLAlchemy to MySQL - sqlalchemy

I'm attempting to connect a python web application to a local database via SQLAlchemy.
I have configured the following connection string:
sqlalchemy.url = mysql+mysqlconnector://root:root#localhost:3306/db_mother
When I use the above, I get the following error (after a long stack trace):
sqlalchemy.exc.ProgrammingError: (ProgrammingError) 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO) None None
When I change the connection string to this:
sqlalchemy.url = mysql+mysqlconnector://ripley:amanda#localhost:3306/db_mother
I get an expected error, because that user is not configured with that password in the db:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) 1045 (28000): Access denied for user 'ripley'#'localhost' (using password: YES) None None
So, in the first case I have a valid db user and password (which I can use to connect via command line or SequelPro), and it says I'm not using a password. In the second case it seems to understand that there is a password. Why does it not have this understanding in the first place?
I am using python3, sqlalchemy, mysql-connector-python and pyramid. It's also of note that if I strip the password from the root user, it works fine.

Related

MySQL shell error while attempting to connect

I want to configure a MySQL server for a wordpress.org project on Windows. However, I can't seem to connect to the MySQL server via MySQL shell.
when I inputted the command \connect root#localhost, and entered the password, I got an error:
MySQL Error 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I assumed that I had forgot my password, and tried saving a txt file with the command
ALTER USER 'root'#'localhost' IDENTIFIED BY 'password';
Yet I got the same error message. I then reset the password with mysqld --skip -grant, and when I restarted MySQL and tried to use \connect, I got the error
MySQL Error 1045: Access denied for user 'root'#'localhost' (using password: NO)
I also tried mysql -u root -p, but got the error
ERROR: Not connected.
Basically everything that didn't start with \ generated a Not Connected error.
I tried using the Command Prompt instead of the MySQL shell, but got the exact same error.
How can I properly access MySQL?

mysql -v ERROR 1045 (28000): Access denied for user root'#'localhost' (using password: NO)

I need help. When Checking mySQL version I get this error. I do not use mysql a lot and I am trying to set up a Magento store through command line. However, first I am trying to set up mySql from the database. I am using Mac OS Catalina and Zsh terminal.
Error.
mysql -v
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I know it must be something with my database but I am confused. Any help would be appreciated. When I try to download Magento 2 setup install I get this similar error.
--db-user=root --admin-firstname=Magento --admin-lastname=User --admin-email=user#example.com --admin-user=admin --admin-password=123123q --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
In InstallCommand.php line 264:
Parameter validation failed
EDIT: However, When I connect to mysql -u root I can connect to the database no problem.
You need to pass in the user and password when running mysql from the command line
mysql -u root -p
[enter password]
Alternatively, you can set up a mylogin.cnf (or a .my.cnf) to save the user/password as a file, so you don't need to remember it.
https://dba.stackexchange.com/questions/86595/how-can-i-make-mysql-client-read-password-from-mylogin-cnf

mysql error Access denied for user 'root'#'localhost'

I just installed MySQL on my pc using tutorial on the YouTube every thing set to default options during the installation the tutorial said that after the installation done I should open the MySQL 8.0 commend line client and then I should type the password to connect the database but when I open it and after I type my password it's close when I press enter so I tried to use the work MySQL workbench it's gives me this popup error I search on the internet for solution I got this here but this solution for ubuntu none of the answers are not applicable on windows but some other solution gives me some other errors :
C:\Users\husam>mysql -u root -p
Enter password: ***************
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
C:\Users\husam>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: NO)
I want to use the MySQL with ruby on rails project on windows 10
the issue wan in my password it's contain ' so I removed it and everything works fine

error in database connection in cloud9.io

This type of questions have been asked many times before.I have tried almost every answer but can't figure out my problem.
i am having problem in mysql database connectivity in cloud9.io environment in sails js project.
Steps
1)mysql-ctl start
2)phpmyadmin-ctl install
it worked and opened phpmyadmin page for me.i created db there.
3)mysql-ctl cli
4)mysql> \r
here's the problem its giving
connection id:1
Current database: *** NONE
There is no error in console while running sails lift.it gives error on executing queries.i have tried all following links related to my problem but no use.
Access denied for user 'root'#'localhost' while attempting to grant privileges. How do I grant privileges?
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
and few more.

MySQL console: change user host in conncetion string

I'm trying to connect to the MySQL database using MySQL console.
MySQL has user: test#% without password.
When i'm trying to connect:
mysql -u test -h 127.0.0.1
I got error:
ERROR 1045 (28000): Access denied for user 'test'#'localhost' (using password: NO)
How i can change user 'test'#'localhost' to 'test#%'?
MySQL has a bit strange logic about the placeholder host, i.e. permissions for the host %. (I'm not sure if "placeholder host" is the correct official name for this.) Namely, the placeholder host does not capture localhost. This can be a bit counter-intuitive.
To be able to log in you will therefore either have to connect from a remote IP (i.e. another computer) or have to grant permissions to test#localhost.