Stop MYSQL service:
sudo service mysql stop
Change home directory of mysql from nonexistent to original directory where it is supposed to be
sudo usermod -d /var/lib/mysql/ mysql
Start MYSQL service
sudo service mysql start
# Install MySQL | |
mysql_config_file="/etc/mysql/my.cnf" | |
echo "mysql-server mysql-server/root_password password secret" | sudo debconf-set-selections | |
echo "mysql-server mysql-server/root_password_again password secret" | sudo debconf-set-selections | |
apt-get -y install mysql-client mysql-server | |
sed -i "s/bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" ${mysql_config_file} | |
usermod -d /var/lib/mysql/ mysql | |
service mysql start | |
# Allow root access from any host | |
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION" | mysql -u root --password=secret | |
echo "GRANT PROXY ON ''@'' TO 'root'@'%' WITH GRANT OPTION" | mysql -u root --password=secret | |
service mysql restart |
Stop MYSQL service:
sudo service mysql stop
Change home directory of mysql from nonexistent to original directory where it is supposed to be
sudo usermod -d /var/lib/mysql/ mysql
Start MYSQL service
sudo service mysql start