Questions about Vagrant

Asked

Viewed 258 times

3

I’m learning to work with the , I have already created the VirtualMachine, made the provisionings, the project worked perfectly.

But when I walk in I see in VirtualMachine to run a script , which runs via shell, is showing connection error with the .

"cdbconnection failed to open the db Connection: could not find driver"

I use the framework . Another thing is when I run Vagrant Reload I lose access to the web server remotely.

  • Can post mysql error message?

  • Displays this message "cdbconnection failed to open the db Connection" I use the Yii framework

2 answers

3


The error message is clear: the Mysql database access driver was not found.

Probably the extension was not enabled. Check your php.ini. On Windows, something like:

extension_dir="C:/php5/ext/"
extension=php_mysql.dll

In other systems, something like:

extension_dir="/usr/lib/php/modules/"
extension=mysql.so

A Windows user said that Yii requires extension=php_pdo_mysql.dll (that is to say, "php_pdo_mysql", instead of "php_mysql").

It is also important to remember restart PHP and/or Apache after making changes to configuration files.

Sources:

  • Thanks for the help ... I just didn’t understand why it doesn’t enable automatically.

1

Your DSN shows that you are trying to use the Mysql driver and the error indicates that the driver is unavailable.

Make sure the extension is installed.

On Ubuntu/Debian you can do the following to check if it is installed

dpkg --get-selections | grep php5-mysql

If not, you can install it like this

sudo apt-get install php5-mysql

Then restart apache for the new settings to take effect.

sudo /etc/init.d/apache2 restart

If already installed check which host Mysql is accepting connections to. Run

sudo nano /etc/mysql/my.cnf

Change the bind-address for 0.0.0.0 to listen to connections from any IP.

bind-address = 0.0.0.0

Give connection permission to all Ips

mysql -u root -p

At Mysql prompt type

use mysql
// Caso o root não possua senha use
GRANT ALL PRIVILEGES ON *.* TO root@'%'
// Se tiver senha use
GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'senha';
FLUSH PRIVILEGES;
exit

Restart Mysql

sudo /etc/init.d/mysql restart

Browser other questions tagged

You are not signed in. Login or sign up in order to post.