David Coder
David Coder

Reputation: 1138

how to connect mysql database to laravel in ubuntu

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.

Upvotes: 0

Views: 5116

Answers (1)

Alupotha
Alupotha

Reputation: 10093

"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

Upvotes: 2

Related Questions