Closed fz883 closed 5 years ago
I think this is mentioned in the docs, just before the setup_database
step.
Make sure the database, user and permissions exist before running the commands.
See https://github.com/jarischaefer/docker-librenms#database---creating-librenms-tables
I think I was not clear enough.
Database - Prerequisites If you don't have a MySQL server setup either in Docker or elsewhere then you can create a docker container here. You should read the LibreNMS installation docs for the latest instructions regarding database setup.
That's what I did. I used the description on the offical page to create a DB with this command:
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Afterwards setup_database
fails. When I create the DB like you do in the Docker MySQL Image like this create database librenms;
it works.
I find it hard to believe that this issue is related to CHARACTER SET or COLLATE, because it works for me with UTF8.
How exactly did you create the user and grant privileges? Did you use the following instructions from the LibreNMS docs?
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
Because these will not work with remote databases or localhost TCP connections (localhost in MySQL refers to connections via Unix socket, whereas 127.0.0.1 refers to local TCP connections).
Does anything I previously stated suggest that? I know that it won't work with librenms@localhost if the DB is remote. I'm not a beginner.
I understand you want to rule that out, but as I said, I only changed the create database
command from the official one to the one you're using. Nothing else, and it works with that command flawlessly. Try it for yourself or just close this issue.
I just tried reproducing it once again, this time using a different server (MySQL 5.7), with no luck.
Please try the following steps to determine whether it is possible to reproduce the issue using MySQL's standard image.
Database
docker run --rm --name mysql -e MYSQL_ROOT_PASSWORD=root -p 127.0.0.1:3306:3306 mysql:5.7
Once MySQL is up and running, execute the following statements:
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'%' IDENTIFIED BY 'librenms';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'%';
FLUSH PRIVILEGES;
LibreNMS
docker run --rm --name librenms -p 127.0.0.1:8080:80 -v /tmp/logs:/opt/librenms/logs -v /tmp/rrd:/opt/librenms/rrd -e APP_KEY=base64:KFyAPsGNAq0+fmwGdbJrzZnj6cpGorr890mgsADjvWM= -e DB_HOST=db -e DB_NAME=librenms -e DB_USER=librenms -e DB_PASS=librenms -e BASE_URL=http://localhost:8080 --link mysql:db jarischaefer/docker-librenms:1.48.1
Once LibreNMS is up and running, execute the following command:
docker exec librenms setup_database
Closing this due to inactivity.
I'm using a DB on a remote host. I followed the instructions here:
And so I created a DB with the following command (as stated on the linked docs):
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
When running setup_database, the command fails:
Running it again:
After a bit of debugging I found out that the instructions for your own MySQL Docker Image work. So creating the DB just with
create database librenms;
fixed the issue for me.Btw, I'm using release 1.48.1