title: How to fix python Mysql.connector error 1698 (28000) access denied
body: <p>I set up a MySQL database on Ubuntu 18.04, and am trying to connect via python using <code>mysql.connector</code>. The database is on the same computer as the instance of python (Acer predator).</p>
  
  <p>Connecting to the MySQL database through the terminal works. But using <code>mysql.connector</code> in python 3.6 keeps producing the following error:</p>
  
  <blockquote>
    <p>mysql.connector.errors.ProgrammingError: 1698 (28000): Access denied
    for user 'root'@'localhost'</p>
  </blockquote>
  
  <p>I keep seeing troubleshooting tips talking about auth_socket or granting privileges even here in Stack Overflow, but these are all focused on connecting with MySQL, whereas my issue is specific to <code>mysql.connector</code> in python.</p>
  
  <p>Code I am using is below, and I've tried it with other users, no password included, and even no host included - but nothing works.</p>
  
  <pre><code>import mysql.connector
  conn = mysql.connector.connect(host='localhost',
         database='exampledatabase',
         user='root',
         password='examplepassword')
  </code></pre>