title: MariaDB, Django, and 127.0.0.1
body: <p>I was using MySQL with Django, with everything working fine.</p>
  
  <p>This is my Django database config—</p>
  
  <pre><code>DATABASES['default'] = {
      'ENGINE': 'django.db.backends.mysql',
      'USER': 'putty',
      'PASSWORD': 'putty',
      'HOST': '127.0.0.1',
      'NAME': 'putty',
  }
  </code></pre>
  
  <p>And here's what I ran in MySQL to create databases and users—</p>
  
  <pre><code>CREATE DATABASE putty CHARACTER SET = 'utf8';
  CREATE USER 'putty'@'localhost' IDENTIFIED BY 'putty';
  GRANT ALL PRIVILEGES ON putty.* TO 'putty'@'localhost' WITH GRANT OPTION;
  </code></pre>
  
  <p>However, when I installed MariaDB, wiped my MySQL data directory, and tried the above, I can no longer connect to my database.</p>
  
  <p>Django says—</p>
  
  <pre><code>OperationalError: (1049, "Unknown database 'putty'")
  </code></pre>
  
  <p>If I change my Django database config as such—</p>
  
  <pre><code>    'HOST': 'localhost',
  </code></pre>
  
  <p>It works fine (this, however, is not feasible since it doesn't work our production MySQL).</p>
  
  <p><strong>How can I force MariaDB to work with a host of 127.0.0.1?</strong></p>
  
  <p>I tried deleting the user and re-creating it with a host of 127.0.0.1, but MariaDB doesn't let me.</p>
  
  <h1>Update</h1>
  
  <p>Logging in at as <code>putty@127.0.0.1</code>—</p>
  
  <pre><code>mysql -u putty -h 127.0.0.1 -p
  SHOW DATABASES;
  </code></pre>
  
  <p>I can only see one database (<code>information_schema</code>).</p>
  
  <p>However, as <code>putty@localhost</code> I can see them all. Weird.</p>
  
  <h1>Update</h1>
  
  <p>Even logging in as <code>root@127.0.0.1</code>, I can't create a database.</p>
  
  <p>When I set <code>--protocol=TCP</code> I get the same; however with <code>--protocol=SOCKET</code> things work fine.</p>