Comments - Configuration update doesn't take effect with mysql service restart
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Thank you for the response and also for requesting to make bind-address visible.
The strange part is the changes is not taking effect after a mysql server restart. I am not sure if any script causing havoc as they are quite straightforward. Here is my script:
mariadbver='10.0' rootpass='mypassword' export DEBIAN_FRONTEND=noninteractive # to avoid prompt during installation sudo debconf-set-selections <<< "mariadb-server-$mariadbver mysql-server/root_password password $rootpass" sudo debconf-set-selections <<< "mariadb-server-$mariadbver mysql-server/root_password_again password $rootpass" # install mariadb server sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq mariadb-server # -qq implies -y --force-yes # set password to the root user and grant privileges Q1="GRANT ALL PRIVILEGES on *.* to 'root'@'localhost' IDENTIFIED BY '$rootpass' WITH GRANT OPTION;" Q2="FLUSH PRIVILEGES;" SQL="${Q1}${Q2}" sudo mysql -uroot -e "$SQL" #---------------------------------------------------------------------- # configuration configfile=/etc/mysql/my.cnf # check if [mysqld] section is there # if found do nothing (:), else append one grep -q '\[mysqld\]' $configfile \ && : \ || sudo sed -i '$ a [mysqld]' $configfile # get an IP of the machine hostip=$(hostname -i | awk '{print $1;}') # if bind-address is there, replace it, else insert one after [mysqld] grep -q "bind-address.*" $configfile \ && sudo sed -i "s/bind-address.*/bind-address=$hostip/" $configfile \ || sudo sed -i "/\[mysqld\]/a bind-address=$hostip" $configfile sudo sed -i "s/bind-address.*/bind-address = $hostip/" $configfile # grant privileges to mysql root user from everywhere Q1="GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$rootpass' WITH GRANT OPTION;" Q2="FLUSH PRIVILEGES;" SQL="${Q1}${Q2}" sudo mysql -uroot -p$rootpass -e "$SQL" # restart mysql service sudo service mysql restartAfter executing the script, when I try to login to the mysql, with 'sudo mysql -hhostname -uroot -pmypassword', it fails. But then if I reboot the machine, the same command works, which indicates that the bind-address change didn't take effect by restarting mysql. Anything missing here?