When I attempted to query a MariaDB (Mariadb is a fork of MySQL) database from a Python script on a CentOS Linux system, I saw the error message "mysql.connector.errors.NotSupportedError: Authentication with old (insecure) passwords is not supported. For more information, lookup Password Hashing in the latest MySQL manual".
$ ./findBook.py
Traceback (most recent call last):
File "./addAmazonAd.py", line 15, in <module>
connection = mysql.connector.connect( host=hostname, user=username, passwd=password, db=database )
File "/usr/lib/python2.7/site-packages/mysql/connector/__init__.py", line 98, in connect
return MySQLConnection(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/mysql/connector/connection.py", line 118, in __init__
self.connect(**kwargs)
File "/usr/lib/python2.7/site-packages/mysql/connector/connection.py", line 382, in connect
self._open_connection()
File "/usr/lib/python2.7/site-packages/mysql/connector/connection.py", line 349, in _open_connection
self._ssl)
File "/usr/lib/python2.7/site-packages/mysql/connector/connection.py", line 172, in _do_auth
"Authentication with old (insecure) passwords "
mysql.connector.errors.NotSupportedError: Authentication with old (insecure) passwords is not supported. For more information, lookup Password Hashing in the latest MySQL manual
$To resolve the problem, I obtained a prompt for the MariaDB database management system (DBMS) under the account from which I was attempting to access the databse and entered the commands shown below where jdoe was the relevant MariaDB/MySQL account name:
$ mysql -u jdoe -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2822
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SET old_passwords=0;
Query OK, 0 rows affected (0.09 sec)
MariaDB [(none)]> set password=PASSWORD('2Access-Info2');
Query OK, 0 rows affected (0.08 sec)
MariaDB [(none)]> exit;
Bye
$Related articles: