snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.03k stars 3.18k forks source link

CentOS - install.sh - snipe-it user - Database connection issue #2150

Closed cengbrecht closed 7 years ago

cengbrecht commented 8 years ago

Expected Behavior (or desired behavior if a feature request)

--- Lx7A4qt&h!bRK3qF < example password --- Using a complex password including & and other characters.


Actual Behavior

Using a complex password causes the install.sh script to fail when trying to connect to the database, or create databases. Checking the passwords, and manually setting the user password to the correct password allows the install script to work, however it fails to populate it, or set the proper password in database.php


Please confirm you have done the following before posting your bug report:

Confirmed issue, Connects to database, but the database is empty (Unknown if this is expected) I would just like a copy of the database to populate it as I believe this would solve the issue.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'snipeit.settings' doesn't exist (SQL: select * from settings where settings.id = 1 limit 1) (View: /var/www/html/snipeit/app/views/backend/layouts/default.blade.php) (View: /var/www/html/snipeit/app/views/backend/layouts/default.blade.php)

Note, after running as user directly not as "su snipe-it" install completed successfully.


Please provide answers to these questions before posting your bug report:

snipe commented 8 years ago

What page are you on that you see that error? Also what version of Snipe-IT are you using? (We ask the questions in the Issue template because they are important.)

Te database tables aren't supposed to be created immediately. You go to /setup and it will create them for you.

cengbrecht commented 8 years ago

WOW, that was fast. I apologize, I did read those, but it was the install.sh, I figured today would be good enough for reference.

System Information

Snipe-IT version v2.1.1-55-g701c16f PHP Version 5.6.22 Laravel Version 4.2.17

I cannot get the name of the page - It is now working, the issue is with the password then, not the aftermath. So the error is a symptom of the install methos, be it using su username or just a complex method, I repeated the methos 4 times using the su username, and only once using the username as the ssh login.

snipe commented 8 years ago

Ah, okay. /setup wasn't added until v3. The install.sh runs a command called php artisan app:install --env=production, which handles your database migrations (creates tables, etc) for you.

Do you see anything in /var/log/snipeit-install.log?

cengbrecht commented 8 years ago

This was is the install.log file, its part of the first attempt to install.

Starting the mariaDB server.

Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariad$

Input your MySQL/MariaDB root password

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Securing mariaDB server.

/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

This was after a few more lines, relating to password issues in the database.php file:

Generating autoload files PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' in /var/www/html/snipeit/app/confi$ {"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"syntax error, unexpected '$ ***If you want mail capabilities, open /var/www/html/snipeit/app/config/production/mail.php and fill out the att$

_Open http://bc-snipe-it.brokedcomputer.com to login to Snipe-IT._