Seahub not starting due to MySQL connection error

Hi all,

I’ve a Seafile 8 installed on a raspberry pi working fine since today. I’ve restarted the system and suddenly Seahub does not start:

LC_ALL is not set in ENV, set to en_US.UTF-8
/opt/seafile/seafile-server-latest/seahub.sh: línea 210: aviso: setlocale: LC_ALL: no se puede 
cambiar el local (en_US.UTF-8): No existe el fichero o el directorio
Starting seahub at port 8000 ...
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

The first alerts regarding LC_ALL and UTF-8 are expected, allways been there.

If I go to the logs, I can see the error in seahub log:

 File "/opt/seafile/seafile-server-8.0.7/seahub/thirdpart/MySQLdb/connections.py", line 185, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on '127.0.0.1' (115)")

I’ve checked the /opt/seafile/conf/seahub_settings.py and the server IP is the 127.0.0.1, database name, user, password are all OK. I’ve reset the password for the seafile user in MySQL (MariaDB 10), but still not able to login (I don’t know if it is expected):

sudo mysql -u seafile -p
Enter password:
ERROR 1698 (28000): Access denied for user 'seafile'@'localhost'

Any idea how to proceed?

Thanks

By the way, I’ve a backup of MySQL database from months ago. I’ve not added/removed libraries nor uses, I’ve just added and modified files in the default admin library.

Can I restore the mysql databases backup safely? Or it would break seafile?

Thanks

Hi all,

I’ve finally found the issue with MySQL (MariaDB 10). By any unknown reason, seems that seafile is using 127.0.0.1 and root is using localhost as server.

I went to the path

etc/mysql/mariadb.conf.d

And edited the file 50-server.cnf, adding a # into the bind-address = 127.0.0.1

After a reboot of MySQL, Seahub started.

Thanks

2 Likes

Another solution for the problem
django.db.utils.OperationalError: (1130, “Host ‘127.0.0.1’ is not allowed to connect to this MySQL server”)
when using Python 3.10 (installed on Ubuntu 22.04) is to update cffi package to version 1.14.6. Read this thread:
https://forum.seafile.com/t/seafile-community-edition-9-0-5-is-ready/16388

And also change the version of cffi package, mentioned in Installation with MySQL - Seafile Admin Manual section “For Seafile 9.0.x” - whole command is:
sudo pip3 install --timeout=3600 django==3.2.* Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient pycryptodome==3.12.0 cffi==1.14.6 lxml

It looks like the user in the database is not configured correctly. You should check the settings in the seafile configuration file and make sure they are correct. Additionally, you should also check the permissions of the user in the database to ensure that it has the right access.