Change to MySQL database

Hi,

I just installed Foreman on a CentOS 7, using the basic foreman-installer,
with basic configuration.
I want to use an external MySQL database, so i've changed
/etc/foreman/database.yml to look like this:

production:
adapter: mysql2
database: puppet
username: puppet
password: x
host: x

then i do a systemctl restart foreman but nothing is changed.

What am I doing wrong, and how do I change the database to a MySQL database?

Kind regards,
Daniel

> Hi,
>
> I just installed Foreman on a CentOS 7, using the basic
> foreman-installer, with basic configuration.
> I want to use an external MySQL database, so i've changed
> /etc/foreman/database.yml to look like this:
>
> production:
> adapter: mysql2
> database: puppet
> username: puppet
> password: x
> host: x

You will also need to install foreman-mysql2.

> then i do a systemctl restart foreman but nothing is changed.

Restart httpd or touch ~foreman/tmp/restart.txt instead.

If you haven't already, you will need to set up the external database
schema and seed the initial data by running:

foreman-rake db:migrate
foreman-rake db:seed

This last step will print the new admin user/password, so take note.

··· On 20/04/16 10:29, Daniel Daniel wrote:


Dominic Cleal
dominic@cleal.org

Thank you.

However when I make the changes and I restart apache I am unable to connect
to the foreman frontend.
I get a ERR_CONNECTION_REFUSED error when i try to go to the URL.

If i make a lsof -i i can see that apache, foreman and everything seems to
be running.
Theres also a connection to the MySQL database.

Its the same if i try to do a completely fresh install of foreman like this:
foreman-installer --foreman-db-adapter=mysql2 --foreman-db-type=mysql
–foreman-db-database=puppet --foreman-db-host=x --foreman-db-password=x
–foreman-db-port=3306 --foreman-db-username=puppet
–foreman-db-manage=false --foreman-admin-password=x
–foreman-admin-username=admin

but if i do it like this:
foreman-installer --foreman-admin-password=x --foreman-admin-username=admin

Its working fine.

I really dont know what is wrong here, but it seems like the installation
gets messed up if i try to change it to use an external MySQL server
instead.

··· Den onsdag den 20. april 2016 kl. 11.30.23 UTC+2 skrev Daniel Daniel: > > Hi, > > I just installed Foreman on a CentOS 7, using the basic foreman-installer, > with basic configuration. > I want to use an external MySQL database, so i've changed > /etc/foreman/database.yml to look like this: > > production: > adapter: mysql2 > database: puppet > username: puppet > password: x > host: x > > then i do a `systemctl restart foreman` but nothing is changed. > > What am I doing wrong, and how do I change the database to a MySQL > database? > > Kind regards, > Daniel >

> Thank you.
>
> However when I make the changes and I restart apache I am unable to
> connect to the foreman frontend.
> I get a ERR_CONNECTION_REFUSED error when i try to go to the URL.
>
> If i make a lsof -i i can see that apache, foreman and everything seems
> to be running.
> Theres also a connection to the MySQL database.

This sounds unrelated to changing the database, unless the entire web
server isn't starting up. It should be easy to determine if the server's
listening, accepting connections, or if there's a problem being logged.
I can't really add anything without more precise information.

> Its the same if i try to do a completely fresh install of foreman like this:
> foreman-installer --foreman-db-adapter=mysql2 --foreman-db-type=mysql
> --foreman-db-database=puppet --foreman-db-host=x --foreman-db-password=x
> --foreman-db-port=3306 --foreman-db-username=puppet
> --foreman-db-manage=false --foreman-admin-password=x
> --foreman-admin-username=admin

This completes without any errors?

··· On 21/04/16 13:32, Daniel Daniel wrote:


Dominic Cleal
dominic@cleal.org