2

I am programming an application by using the Slim Framework in PHP and MySQL. I am on Mac OS X and using XAMPP.

I have tried this solution but no luck.

In my phpmyadmin I have the root user's servers in the three modes:

  1. %
  2. linux
  3. localhost

This is the code of configs to connect to the database:

'db'    =>  [
    'driver'    =>  'mysql',
    'host'      =>  '127.0.0.1',
    'name'      =>  'rl',
    'username'  =>  'root',
    'password'  =>  'the_password',
    'charset'   =>  'utf8mb4',
    'collation' =>  'utf8mb4_unicode_ci',
    'prefix'    =>  ''
],

Any ideas to fix this?

FIXED

I changed 127.0.0.1 for localhost and now it works!

Now the question is, how can i make it work by using 127.0.0.1?

Pathros
  • 10,042
  • 20
  • 90
  • 156

1 Answers1

0

I had simmilar problem and the charset was wrong and it should be just utf8 like that:

'db'    =>  [
    'driver'    =>  'mysql',
    'host'      =>  'localhost',
    'name'      =>  'rl',
    'username'  =>  'root',
    'password'  =>  'the_password',
    'charset'   =>  'utf8',
    'collation' =>  'utf8_unicode_ci',
    'prefix'    =>  ''
],