I have installed lampp on a centos server that mysql server has been installed on. I removed mysql and I can access databases by this command on server:
/opt/lampp/bin/mysql -u username -p
When I want to access a database on this server by PDO in a php file, I receive this error:
[2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I also removed var/lib/mysql
directory.
What is the solution?