0

So, I am trying to make a website that uses PDO to access a MySQL server for registering accounts and logging in etc. However, whenever I try to connect to the MySQL server I get this error: Error when a connection attempt is made

I've allowed friends to attempt to access the database too and they are able to without any difficulties.

Here's what my code looks like: Code (Scribbles is my password)

Any help at all would be appreciated.

Ethan Lea
  • 3
  • 2
  • 1
    Determine whether you have the mysql driver for pdo: https://stackoverflow.com/questions/3131411/php-code-to-test-pdo-is-available (your exception suggests otherwise). – Progrock Feb 13 '18 at 13:08

2 Answers2

0

I cannot comment yet, but this error often occurs when you don't have the pdo_mysql module installed.

Try a phpinfo() in the directory of your site. If you can't find the pdo_mysql module, have a look at the doc to install it:

http://php.net/manual/en/ref.pdo-mysql.php

Michael S.
  • 116
  • 1
  • 8
-1

Check if you have included the widening pdo_mysql in file php.ini If there is not then a line and restart Apache

ScreanShot php.ini

Community
  • 1
  • 1