0

I am new bee in laravel. I am using ubuntu terminal. I have installed laravel and created one database and one table using terminal. Now i want to connect that database with my laravel project. I have changed database name, username and password in app/config/database.php. But don't know the connection is establish or not.

In database.php i have changed in mysql array:

'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'prac',
            'username'  => 'root',
            'password'  => 'admin',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),

When i fetch the data from table it display pdoexception could not find drivers. I want connection with mysql.

8
  • 1
    install php5-mysql i.e. sudo apt-get install php5-mysql for php5.x Commented Nov 7, 2015 at 5:42
  • i think i need to install pdo driver ??? Commented Nov 7, 2015 at 5:45
  • @chetan sir I have tried this but same error.. Commented Nov 7, 2015 at 5:47
  • yes php5-mysql or php-mysql will install the dependencies also Commented Nov 7, 2015 at 5:48
  • 1
    after installation you need to restart apache server Commented Nov 7, 2015 at 5:49

1 Answer 1

2

"pdoexception could not find drivers" this error seems to be you don't have php mysql extension installed in your machine

Check is it installed ? using this command dpkg --list | grep php5-mysql If this command give nothing then you don't have php5-mysql extension. You can install it using following command

sudo apt-get install php5-mysql

after that you have to restart your apache server for load the new extension

sudo service apache2 restart
Sign up to request clarification or add additional context in comments.

1 Comment

Quick note: use sudo apt-get install php-mysql if you want the latest version (in my case, php7.1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.