Some time you may want to backup your home directory and mysql databases to a new server, we can do that using rsync script. The below script when run from your new server will, rsync all your home dir to your new server.
#!/bin/bash
#by-admin@serversignature.com
#Old Server IP
IP=192.168.0.1
#Scrit is run from the new server to move the [...]
How to change mysql time zone
Edit /etc/my.cnf and change your time zone.
root@box1 [/var/lib/mysql]# cat /etc/my.cnf
[mysqld_safe]
timezone = Europe/London
~
[mysqld]
set-variable = max_connections=500
safe-show-database
Login to mysql and check the time now.
root@box1 [/var/lib/mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 369
Server version: 5.0.81-community MySQL Community Edition (GPL)
~
Type ‘help;’ or ‘\h’ [...]
Setting up the Tunnel
The most common methods of setting up a tunnel are through putty or through command-line SSH.
To open an SSH tunnel via the command line, run:
ssh -L3307:127.0.0.1:3306 -p 22 -N -t -x user@myhost.com
Connecting with MySQL
You can connect to the MySQL server!
You want to choose 3307 for your local port so that it does [...]
Create a mysql database and User
mysql> CREATE DATABASE database1;
For creating a new user with all privileges (use only for troubleshooting), at mysql prompt type:
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘yourusername’@'localhost’ IDENTIFIED BY ‘yourpassword’ WITH GRANT OPTION;
For creating a new user with fewer privileges (should work for most web applications) which can only use the [...]
Set mysql root password
Before accessing the database by console you need to type:
mysql -u root
At the mysql console type:
mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);
Installing MYSQL with PHP 4
apt-get install mysql-server libapache2-mod-auth-mysql php4-mysql
Installing MYSQL with PHP 5
apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Install LAMP stack in Ubuntu
As of the 7.04 release +, the Ubuntu base system includes Tasksel.
You can either install LAMP using tasksel or install the LAMP packages as detailed above.
sudo tasksel install lamp-server
To remove the LAMP stack remove the following packages:
apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0 mysql-common [...]