MysticRyuujin / guac-install

Script for installing Guacamole on Ubuntu
988 stars 272 forks source link

Fix mysql password error #126

Closed blinklet closed 4 years ago

blinklet commented 4 years ago

The script fails when run in Ubuntu 19.10. MySQL fails to restart after the timezone is changed because the MySQL password is not defined. (The script passes in Ubuntu 18.04)

The script sets the MySQL password after it calls the MySQL command to change the timezone so the timezone change fails. This causes the script to fail when it is run in Ubuntu 19.10. I moved the statement that sets the password to a place where it sets the password before any MySQL commands are run.

I tested the change in both Ubuntu 19.10 and Ubuntu 18.04.

blinklet commented 4 years ago

Here is the original debug output from running the original version of the script in Ubuntu 19.10:

Setting timezone as Etc/UTC
+ mysql_tzinfo_to_sql /usr/share/zoneinfo
+ mysql -u root -D mysql -h localhost -P 3306
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
+ crudini --set /etc/mysql/mysql.conf.d/mysqld.cnf mysqld default_time_zone Etc/UTC
+ service mysql restart
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
+ echo

+ guacUserHost=localhost
+ [[ localhost != \l\o\c\a\l\h\o\s\t ]]
+ export MYSQL_PWD=password
+ MYSQL_PWD=password
MysticRyuujin commented 4 years ago

You're setting it in an if statement, but originally it's set explicitly. I'm not near a computer but that seems like it would have unintended consequences if that if statement doesn't evaluate to true?

blinklet commented 4 years ago

Good point. I moved it back before the IF statement.