I had the default installations of php mysql and apache but changed it around to use xampp. Main reason being having everything in the one folder so it could all be backed up as one, and also for rsynking between machines.
But I hit a problem. I used the package manager to remove the server and db then downloaded and installed Xampp. The install went fine and i was up and running in next to no time. The problem came when i tried to import my largest SQL file.
Its 400+ meg so there was no way phpMyAdmin would be able to handle it. I went into shell and when I try from there it gives the following error...
root@mack-desktop:/opt/lampp/bin# mysql -uroot -ppassword -h localhost uk < /home/mack/Documents/Websites/example/data/datafile.sql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
It seams as if mysql client is still trying to reference the old install.
The connection to the MySQL server is controlled in the my.cnf file. You can find it probably in your /etc directory. The [mysqld] section contains the settings used by the server when it starts up. The [client] section contains the settings for the mysql command-line client. In both sections there is a line:
These two lines in the [mysqld] and [client] section must be the same. Otherwise the client is unable to find the server.
Now it gets interesting. The default Ubuntu install of mysql is Root > etc > mysql and that folder is still present. It doesn't have the actual DB server but it does have my.cnf
Because I removed mysql and them reinstalled in another location opt > lampp... the paths will be totally wrong. I did however install mysql client through the package manager so it will almost certainly be trying to use the default my.cnf file.
Should I un-install mysql client and do a manual install from source, or just edit the default my.cnf file.
The MySQL server and the client are two different software packages and they work independent of each other. You should be fine editing the my.cnf which is used by the client. You may have two my.cnf files now on different locations because your XAMPP installation uses the /opt tree, while the client is /etc oriented.
The client doesn't need to know the directory path where the server or the databases are located. All it does is connect to the server through a socket or through a network connection, depending on the settings in the my.cnf file.