-
Notifications
You must be signed in to change notification settings - Fork 15
Mysql server
Parrot comes with a MySQL server instance, that will tune itself to the size of VM it's provisioned on. A default MySQL user is set up for accessing databases from both guest and host OS.
You can access the MySQL server from the host machine via port forwarding using the following details:
mysql://root:[email protected]:3306/
So you can use the following command line to connect:
mysql -u root -proot -h 127.0.0.1 -P 3306
From either the guest or host.
To use these settings with Drupal you need something like the following in your settings.php:
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => '{database}',
'username' => 'root',
'password' => 'root',
'host' => '127.0.0.1',
'port' => 3306,
);
To make it really easy to import databases into Parrot, you can simply pop a database_name.sql
or database_name.sql.gz
file into the databases
directory on the host and run vagrant provision
and Parrot will ensure that there is a database in MySQL called database_name
and will import the file into that database, extracting the file on the fly using gzip if needed.
This means that you can easily do a vagrant destroy;vagrant up
and effectively reset the VM and databases back to a good working state very quickly.
If you want to rebuild your VM you may find that you restore old (or empty!) databases instead of the databases with the latest data in them.
If you want to quickly dump all the databases in the VM out into the auto import database folder then you can run the following script and Parrot will mysqldump
them all out.
scripts/dump-databases.sh
The default MySQL config supplied with Parrot contains some performance optimisations depending on the amount of memory the guest VM has. These are specified in the /etc/mysql/conf.d/parrot.conf
file, which is auto-generated by Puppet. Everything else is standard Ubuntu.
We also specify the bind-address
as 0.0.0.0
, so MySQL is listening on all of the guest's network interfaces.