Details: The error is shown as follows:
GGSCI (oraclelinux6.localdomain) 5> dblogin sourcedb test@localhost:3305 userid root Password: 2014-07-22 15:13:33 WARNING OGG-00769 MySQL Login failed: . SQL error (2002). Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). ERROR: Failed to connect to MySQL database engine for HOST localhost, DATABASE test, USER root, PORT 3305.
Answer: The reason is the file doesn't exist in the /tmp folder. Oracle Golden Gate for MySQL by default requires the access of the MySQL socket file. By default, it is /tmp/mysql.scok If the file is not in the folder you can create a symbolic link as follows:
ln -s /home/oracle/software/mysql_5.5.38/data/mysql.sock /tmp/mysql.sock
If you have multiple MySQL instances on the same server (For example, in my environment, I have MySQL 5.5, 5.6 and 5.7 setup in one machine). you can set the MYSQL_UNIX_PORT environment variable as follows:
MYSQL_UNIX_PORT=/home/oracle/software/mysql_5.6.19/data/mysql.sock export MYSQL_UNIX_PORT
When using Oracle GoldenGate you can use the SETENV set as follows:
SETENV (MYSQL_UNIX_PORT='/home/oracle/software/mysql_5.6.19/data/mysql.sock')
This will address the issue.
References
References
- GGSCI DBLOGIN to MySQL Login failed: . SQL error (2002). Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). (Doc ID 1515632.1)
(Created: 7/2/2014 Last Reviewed: 6/14/2015)