Cannot initialize database at the first rul

Hi!

I installed tt-rss on a debian 9 VPS with php7.0, apache2, and mysql deployed.

Every things work fine until I pressed the “Initialize Database” button. It shows “Query: drop table if exists ttrss_error_log”

19

This really bothers me, for if I just skip initialize my database, only a blank page would show up after the installation.

Are there any solution to fix this problem?

Thanks in advance!

Hans

Have you checked your Apache and PHP error logs?

My first guess would be that the MySQL user (the one defined in config.php) accessing the database doesn’t have appropriate permissions for the database. Day-to-day TT-RSS just needs the usual select, update, insert, etc. but during installation and upgrades needs to be able to create, alter, drop, etc. tables. Best thing is to just give the database user all privileges. Again, though, this assumes that error.

Check the logs on the server. Worst case, you can import the schema directly from the command line:

mysql database_name < path-to-tt-rss/schema/ttrss_schema_mysql.sql

I’d like to add that it would be better to create an individual database user for every application/database you are using.

mysql -u root -p # get mysql shell
USE mysql;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # create new user with password – change this also in config.php
GRANT ALL PRIVILEGES ON database_name.* TO 'newuser'@'localhost'; # with ALL PRIVILEGES you avoid permission problems – maybe changes this later for more security
FLUSH PRIVILEGES;

Many thanks for your reply! But I have already figured out what had happened.

It is the privilege setting that makes my installation not successful. I forgot that for the command GRANT ALL PRIVILEGES ON [database name].*, the last asterisk should remain its original to grant all privileges to every rows in the database.

Still, thank you for your reply!

Thanks! That is exactly the problem I confronted. The solution works.

installer should probably report the error there
did it just die after the query?

I wonder if doing a SHOW GRANTS FOR CURRENT_USER; might be a good idea when the installer tests the database connection. Then provide a warning if it’s not all privileges or a list of what’s needed?

Yes. I waited for about 1 hour and nothing happened.

Thanks! I will try this command out.

this is a bit too mysql-specific, i think proper error reporting would be good enough.