epsilones
epsilones

Reputation: 11609

symlink and unsymlink with existing files

Sorry if it seems to be too a simple question or if I have to move my post to another forum (plz tell me if so). I have a problem running mysql, I keep on having an error

Can't connect to local MySQL server through socket '/tmp/mysql.sock'(call it files1)

but the right place to find socket is /Applications/MAMP/tmp/mysql/mysql.sock(call it files2)

So I have to files files1 and files2 and I want to symlink the first by the second like so ln -s files1 files2. Now suppose I want to unsymlink, do I delete files2, if I run rm files2 to unsymlink ?

Upvotes: 2

Views: 2936

Answers (1)

Vorsprung
Vorsprung

Reputation: 34307

Deleting the symlink will remove it. The "target" of the symlink will not be deleted

so if you say

ln -s /tmp/mysql.sock /Applications/MAMP/tmp/mysql/mysql.sock

This means that the socket is "found" at /Applications/MAMP/tmp/mysql/mysql.sock as well as /tmp/mysql.sock

if you then do

rm /Applications/MAMP/tmp/mysql/mysql.sock

/tmp/mysql.sock still exists but the link at /Applications/MAMP/tmp/mysql/mysql.sock is gone

Upvotes: 5

Related Questions