After I installed mysqld (mysql server), I have met frustrated situation.
When I try to connect mysql server to mysql (default client) by using root, there are some a error message shown on termial. 

Mysql have launched to socket file is used to connect mysql client.

[handbs310:/root]# ./mysqld/bin/mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

But, I can connect the mysql server by using below command.

./mysqld/bin/mysql -uroot -S /usr/local/mysql/tmp/mysql.sock -p

so, I have to change that, because of bothering. 

To solve the uncomfortable things, there is need to take two steps.

1) Create a symbolic link 

ln -s /home1/irteam/db/mysql/tmp/mysql.sock /tmp/mysock.sock
lrwxrwxrwx  1 root root 37  5¿ù  8 18:20 /tmp/mysock.sock -> /home1/irteam/db/mysql/tmp/mysql.sock

2) Change configuration
#socket = /usr/local/mysql/tmp/mysql.sock
socket = /tmp/mysql.sock

#default-character-set = utf8
user    = irteam
port    = 3306
basedir = /usr/local/db/mysql
datadir = /usr/local/db/mysql/data
tmpdir  = /usr/local/db/mysql/tmp
#socket  = /home1/irteam/db/mysql/tmp/mysql.sock
socket  = /tmp/mysql.sock

After taking two steps, kill mysql daemon, and restart it.
Then, You will connect without given -S option by using default mysql client.

 mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.40-log MySQL NHN MAX Version

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> Bye

Posted by '김용환'

댓글을 달아 주세요