Seafile-server-installer: Failed to connect to mysql server using user "root" and password "***": Access denied for user 'root'@'localhost'

Failed to connect to mysql server using user "root" and password "***": Access denied for user 'root'@'localhost'

I’m getting this error when trying to install seafile with the install script on Ubuntu 16.04.02, on a completely fresh DigitalOcean droplet. I followed the instructions on the github exactly but still get this error. I also tried my luck on CentOS 7 but got an error “FirewallD not running”. I’ve made a fresh install of ubuntu 16.04 multiple times and still get the same error. How can I fix this?

I’m getting this same issue. I enabled the root user and ran the install script as that user. I have also ran the script as sudo with the user I created. My setup is a fresh Ubuntu 16.04.02 LTS basic server install on a KVM VM on a 16.04.02 LTS VM server.

Update One:
The script is failing to connect to the database at line 408 of the seafile_ubuntu script (). The python checks of setup-seafile-mysql.sh are successful, so it executes setup-seafile-mysql.py.

At line 1336 of that script it calls db_config.check_mysql_user, (lines 480-499). The messages shown on the terminal match what I would expect if the failure is happening at this point (see below).

Processing triggers for ureadahead (0.100.0-19) ...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 21.4M  100 21.4M    0     0  3146k      0  0:00:06  0:00:06 --:--:-- 3621k
Checking python on this machine ...
Checking python module: setuptools ... Done.
Checking python module: python-imaging ... Done.
Checking python module: python-mysqldb ... Done.

verifying password of user root ...
Failed to connect to mysql server using user "root" and password "***": Access denied for user 'root'@'localhost'

Going to look into why the login is failing. I know just enough Linux to get in trouble, a moderate amount of Python, but very little about databases, so I’m quickly hitting the point where I’ll need help.

Update:
Attempted to login to the database at the command line. This is where my knowledge ends. I tried using:

  • The seafile user and the password stored in /opt/seafile/.my.cnf
  • The root user with password from /root/.my.cnf
  • The local user on my server (username and password redacted)

All these gave the following error:

$ mysqladmin -u seafile -p status
Enter password:
mysqladmin: connect to server at 'localhost' failed 
error: 'Access denied for user 'seafile'@'localhost''

I’ve exhausted my abilities debugging this, so help would be greatly appreciated. Thanks in advance!

Thanks so much for the reply. I’ve almost given up on using the install script and started installing it manually.

When installing it manually though, I don’t get these errors. The reason I don’t can’t install it manually is that I run into issues when trying to set up nginx, ssl, WebDAV, etc all of which I need. But I do pass the database set up, which makes me think either MariaDB wasn’t installed correctly, or it’s expecting the wrong password.

Digitalocean allows you to start from an Ubuntu LEMP installation (note the I’m not using this for the auto install script), so using their installation of mysql works fine, but using the script’s install of mysql might not be working.

I’m very new to linux, servers, and databases so there’s not much I understand.

Edit: Accidentally prematurely hit post, as I’m typing on my phone right now.

RESOLVED! This was a silly easy resolution.

The issue is I wasn’t aware there was a new version of seafile available. The command I was executing was:
$ sudo bash seafile_ubuntu 6.0.2

The script setup-seafile-mysql.py had been updated to address issues with using “127.0.0.1” for local host. I was able to resolve this by changing to the latest version of seafile at the command line:
$ sudo bash seafile_ubuntu 6.0.9

1 Like

I try install script for all day long. I have the same problem.
“Failed to connect to mysql server using user “root” and password “***”: Access denied for user ‘root’@‘localhost’”

Finally, I find the file in /root/.my.cnf
Just 3 lines, It looks like

[client]
user=root
password=1234abcd

(after I extract the file “seafile-pro-8.0.11…tar.gz”, and read the /seafile-pro-server-8.0.11/setup-seafile-mysql.py)
You must change the root’s password for your DB server in this file. ( password can not be the EMPTY)
It works for me.