Ubuntu an Debian based Linux distros can be set up for automatically executing scripts on startup and shutdown.
For that, a symbolic link of the script we wan to run must be placed in /etc/init.d/ and then update-rc.d must be invoked. This application takes care of the particularities which must be followed in terms of file naming and linking under the different /etc/ folders such as rc1.d rc2.d rc3.d rc4.d, rc5.d, rc6.d and so.
If we want the script to run at startup just type:
- >update-rc.d <scriptname> defaults
- >update-rc.d <scriptname> stop 0 1 6 .
Root access from an external host to MySQL
It may sometimes occur that you want to access a MySQL server as root from an external machine. MySQL avoids this by default.
You can however change this. Obviously you will first have to login as root to MySQL from the host machine or via SSH, and then type:
> GRANT ALL PRIVILEGES ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
Then you may want to flush:
> FLUSH PRIVILEGES;
After this you must locate the MySQL configuration file (/etc/mysql/my.cnf) and find the file which says:
bind-address = 127.0.0.1
COOMMENT IT OUT with a # so it now reads
#bind-address = 127.0.0.1
Then you must restart your MySQL server for the changes to have effect:
service mysql restart
You will now have access from any remote machine.