I tried to access MySQL from Python 3.3 with the following methods:
import mysql.connector
config = {
\'user\': \'###\',
\'password\': \'******\',
\'h
I was having this problem when I was trying to transfer data from a python script to a MySQL database on a Raspberry Pi.
When you initially install MySQL it sets you up as the user 'root' with whatever password you enter. If you changed the security settings afterwards to have strong passwords (like I did) your password must have uppercase, lowercase, digit and special characters.
This may be what's throwing an error when you try to connect to the database.
To remedy this:
Log in to MySQL:
sudo mysql --user=root
Delete the root user:
DROP USER 'root'@'localhost';
Create a new user:
CREATE USER 'root'@'localhost' IDENTIFIED BY 'password';
Give the user all permissions:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;