I've written a few programs in C that access the local MySQL database on my linux system, the problem is this when I run one of my C programs it comes up with this error:
Error on connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Then if I edit the socket entry in the /etc/my.cnf file to /tmp/mysql.sock and restart the mysql deamon my C programs work!
But then if I try to enter into MySQL by typing 'mysql -uroot -p' at the command line it comes up with this error:
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
If its not one error its another - how would I go about getting around this? is it another option that I add when compiling my programs?
This is an example of what options I use when compiling:
gcc testprog.c -o testprog -I/usr/local/mysql/include -L/usr/local/mysql/lib -lmysqlclient -lz
Thanks
Error on connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Then if I edit the socket entry in the /etc/my.cnf file to /tmp/mysql.sock and restart the mysql deamon my C programs work!
But then if I try to enter into MySQL by typing 'mysql -uroot -p' at the command line it comes up with this error:
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
If its not one error its another - how would I go about getting around this? is it another option that I add when compiling my programs?
This is an example of what options I use when compiling:
gcc testprog.c -o testprog -I/usr/local/mysql/include -L/usr/local/mysql/lib -lmysqlclient -lz
Thanks