Friday, June 28, 2013

Connect XAMPP's mysql on Linux terminal

Access XAMPP's mysql on Linux command line :

If you want to operate xampp's mysql on Linux terminal, follow the procedure.

By default, if you run
# mysql
It tries to connect to default mysql of the system and unfortunately default mysql is not XAMPP's mysql.

To open the xampp's mysql prompt on terminal, Run following command.
# /opt/lampp/bin/mysql or # /opt/lampp/bin/mysql -u root or # /opt/lampp/bin/mysql -h localhost -u root -p Default Password is blank, just press enter key.
/opt/lampp/bin/mysql is the path of the mysql binary file of xampp.

If you want to run XAMPP's mysql using 
# mysql
You should follow these steps.

1) Stop xampp & copy file /opt/lampp/bin/mysql
2) Rename the file /usr/bin/mysql to /usr/bin/mysql_default
    If you haven't installed mysql on your system, you will not get the file.
3) Paste file  /opt/lampp/bin/mysql into /usr/bin
4) Now whenever you will run mysql on terminal, it will open XAMPP"s mysql prompt.

Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

If you have installed apache2 and while starting or restarting apache2, you get this error. Try following steps to remove it.

Solution :

Add following line in /etc/apache2/apache2.conf
ServerName localhost
Restart apache2
# service apache2 restart
Now try again.

Thursday, June 27, 2013

ssh Error : scp: ambiguous target

scp: ambiguous target

If you are transferring files from your host to another host and there are spaces in the path, you could get this error.

If there are spaces in the directory name of source (your system) and you have used double quotes in the path, you will not get the error but if there are spaces in the directory name of destination (remote host) and you have used double quotes in the path, you could still get the error.

To remove this error
Use backslash before spaces.

Suppose there is a directory "linux host" in the root of Remote Host and you want to transfer a file test.txt from your root directory to the remote host directory  "linux host". You should use this command.
# scp "/root/test.txt" 192.168.xx.xx:"/root/linux\ host"
Since there is space in the directory name "linux host" that's why I have used backslash before space.
Now you will not get the error while file transfer.

If you put just double quotes in the remote host path and you do not put backslash before space, you will get the error scp: ambiguous target

One more example :
# scp "/root/Documents/file.txt" 192.168.xx.xx:"/root/untitled\ folder/red\ hat/linux\ host"
where
192.168.xx.xx is IP of Remote Host