Issues accessing MySQL after upgrading from 6.3 to 7.0

Hello everyone!

I recently upgraded my Docker Seafile Pro server from 6.3 to 7.0 using the steps outlined in the documentation. The upgrade went okay but the ‘seafile’ container cannot connect to the seafile-mysql container.

I’ve confirmed that all my database passwords match in ccnet.conf, seafile.conf, and I’ve also updated my Seafile database password using the commands as per the documentation. After I completed the steps and deleted the original container I tried the following commands again against the newly created seafile-mysql container to ensure all my passwords match:

	sudo docker exec -it seafile-mysql /usr/bin/mysql -e "grant all on *.* to 'root'@'%.%.%.%' identified by 'mydatabasepassword';"

	for database in {ccnet_db,seafile_db,seahub_db}; do sudo docker exec -it seafile-mysql /usr/bin/mysql -e "grant all on ${database}.* to 'seafile'@'%.%.%.%' identified by 'mydatabasepassword';"; done

I’m also using the docker-compose.yml file from here with the passwords updated to reflect mydatabasepassword as above.

However, after executing docker-compose up I see the following errors:

	 [2019-11-03 21:09:19] Now running setup-seafile-mysql.py in auto mode.
	 Checking python on this machine ...
	   Checking python module: python-mysqldb ... Done.

	 Checking for java ...Done.
	 verifying password of user root ...  done
	 verifying password of user seafile ...

	 Failed to connect to mysql server using user "seafile" and password "***": Access denied for user 'seafile'@'192.168.64.5' (using password: YES)

	 Traceback (most recent call last):
	   File "/scripts/start.py", line 86, in <module>
	     main()
	   File "/scripts/start.py", line 56, in main
	     init_seafile_server()
	   File "/scripts/bootstrap.py", line 140, in init_seafile_server
	     call('{} auto -n seafile'.format(setup_script), env=env)
	   File "/scripts/utils/__init__.py", line 69, in call
	     return subprocess.check_call(*a, **kw)
	   File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
	     raise CalledProcessError(retcode, cmd)
	 subprocess.CalledProcessError: Command '/opt/seafile/seafile-pro-server-7.0.10/setup-seafile-mysql.sh auto -n seafile' returned non-zero exit status 255
	 *** /scripts/start.py exited with status 1.
	 *** Shutting down runit daemon (PID 26)...
	 *** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
	 Nov  3 21:09:19 86d4652ae517 syslog-ng[18]: syslog-ng shutting down; version='3.13.2'
	 *** Killing all processes...

I’ve attempted to access the seafile container by executing docker exec -it seafile /bin/bash and connecting to the seafile-mysql container manually via this simple Python script to emulate what the setup-seafile-mysql.py script is doing:

	import MySQLdb

	conn = MySQLdb.connect(
		host='192.168.64.5',
		port=3306,
		user='root',
		passwd='mydatabasepassword'
	)

	print(conn)

	conn = MySQLdb.connect(
		host='192.168.64.5',
		port=3306,
		user='seafile',
		passwd='mydatabasepassword'
	)

	print(conn)

Executing the above script results in a successful connection for both root and seafile users, and therein lies my predicament – if the seafile container is able to connect to my seafile-mysql container then why does it fail when I docker-compose up?

Any advice will be greatly appreciated.

i also used docker-compose file to launch my test seafile server many times before…but I am not from existing database…
I encountered similar issue before and I notice the script in seafile container are below 2:
/etc/my_init.d/01_create_data_links.sh…
/etc/my_init.d/10_syslog-ng.init…

if these 2 are failed, you are not able to set up the seafile application thru docker-compse.yml file.

maybe you can try to install a fresh one and mysqldump your old mysql backup to it…hahaha
just try :non-potable_water:

I re-installed the server from scratch and copied the Seafile data and MySQL data directories into the new installation and all is now working. I’ve spent enough time on it to try and figure out the root cause so I will simply relish in the fact that it’s now resolved :slight_smile:

Thanks for the help!

Cool yes that is always working for me in that way.
Copy whole folder and restart service hahha
Good to hear that :slight_smile: