Executable trying to connect to wrong MySQL socket file location - mysql

I have a set of executables (specifically BOINC server executables, but I don't think it matters) that I am trying to run on an Ubuntu 16.04 system. These executables were built on a different machine and use a version of the MySQL client library that was built on a RHEL 6.6 box (the release plan is to build everything on the RHEL 6.6 box and deploy it together, but the current executables were not built there).
The RHEL 6.6 box is configured to put its MySQL socket file at /var/lib/mysql/mysql.sock.
The Ubuntu 16.04 box is configured to put its MySQL socket file at /var/run/mysqld/mysqld.sock.
When I try to run one of the executables that connects to the database on the Ubuntu 16.04 box, I get the following error:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
The error comes straight out of the mysql_real_connect function. Only these executables give me that error. The mysql commend works fine. mysql_config --socket returns /var/run/mysqld/mysqld.sock, just as I expect it to.
I have tried all the suggestions I could find about editing the config files. I have added both a ~/.my.cnf file and a /etc/mysql/mysql.conf.d/client_socket.cnf file that specify the socket file location in a [client] section, per all the other sources for dealing with socket file locations. None of it changed the behavior of the executables; they always look for /var/lib/mysql/mysql.sock as if something were hard-coded to do it. I can't find anything that is, though.
I have been beating my head against this problem for a while, and I cannot figure out what is going on. I ended up opening up the permissions on /var/lib/mysql and symlinking the real socket file to the expected location, but that feels like a hack. What is going on here? Why are my executables seemingly ignoring all MySQL system configuration? What is the proper way to fix this? Could this actually be hard-coded somewhere?

I just searched the BOINC source tree and tend to think that it is not hard code in the literal sense of the word but it is fixed at compilation time. See
https://github.com/BOINC/boinc/search?utf8=%E2%9C%93&q=mysql&type=
The proper fix to me is to either compile the BOINC source tree yourself on your machine, to use the cloud images prepared by the BOINC developers https://boinc.berkeley.edu/trac/wiki/CloudServer or to look at the instructions on wiki.debian.org/BOINC, of which I am unsure about how well this adapts to Ubuntu.

Related

OSX MySql terminal parameters

So I am going crazy with this. I have MAMP installed and it's MySQL is working fine. I now installed MySQL 5.7.19 from the official dmg from their site and installed.
From the pref panel I am not getting status updates and as such I cannot stop it even though it is running. Trivial though as I can launctl unload it.
However, the big issue I am facing is that although the server starts correctly (from pref panel) and I can see the process running and the respective /tmp/mysql.sock file when I try to run mysql in terminal (or any other mysql command) I get an error stating it cant find the sock file and it pipes out the Applications/MAMP path.
I looked everywhere for a my.cnf that might be setting this and there are none (apart from the one used by MAMP). No environment variables set to override it, nothing. In fact, there are no other my.cnf files but for some reason it still thinks it should be using /Applications/MAMP path.
my_print_defaults client confirms this as it pipes out
--socket=/Applications/MAMP/tmp/mysql/mysql.sock
but I have absolutely no idea where and how this is being set and I need to be able to run on this instance terminal commands. Driving me crazy for hours now.
No files at
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
No environment variable MYSQL_UNIX_PORT as described here: https://dev.mysql.com/doc/refman/5.7/en/problems-with-mysql-sock.html
So how the heck is it getting this value?
Also checked at DATA_DIR and BASE_DIR, no my.cnf there either.
Obviously Ive done which mysql to confirm I am calling the correct binary.
Any help much appreciated!
UPDATE Running my_print_defaults client --verbose --no-defaults pipes the same exact output, so I am guessing it is somehow set elsewhere. Where can this variable be set otherwise?
Ok so I found the answer after all and sharing it for anyone having the same issue.
In essence, the --socket parameter is added via the ~/.mylogin.cnf file!
I am not sure if I ever added it there but I am pretty sure it wasn't me, so I am guessing MAMP did it.
This is an encrypted file so you can't edit it directly by you can change it via mysql_config_editor:
mysql_config_editor remove --socket
And problem solved!

Is there a way to use mysql client binary tool without installing to connect to another mysql server?

Here is the situation, I have access to some servers and don't have the root privilege to install mysql-client using 'yum', so I'm wondering maybe I can find some binary tool downloaded directly from internet to connect to another mysql server. I googled it, but failed. Does anybody know where I can find such thing? or some other solutions to my question?
The standard mysql client command line utility can be used in any Linux machine to connect to a MySQL Server anywhere if you have connectivity to TCP port 3306.
From http://dev.mysql.com/downloads/mysql/, download MySQL Server, Linux, Generic, 64 bit (or 32 bit) TAR Archive. Un-tar it, and look for the program file called mysql in the directory bin/. That's the command line client. It doesn't need to be installed, just copy that file into your oath or run it from the current direcrory.

Install mySQL on Redhat specifying a different location

I need to put the datafiles for mySQL 5.5 community server on a different location than the default (it would be helpful if the log could go there too). Is this something I can do at the command line or after install.
This is on Redhat
It looks the only way to do this is by building from source and specifying the home during Make. I would put down instructions but I am having a devil of a time getting it to build.

Recommended MySQL tuning utility for Windows

I have been using MySQL Tuner (http://mysqltuner.com) on Linux for a while and am quite comfortable with it. Now, for whichever reason, we have had to start hosting other websites on IIS. Is there a similar tuning utility that may recommend config changes to MySQL on Windows Server 2008?
Kind regards
I have just ported the mysqltuner.pl script to Windows - see http://mysqltuner.codeplex.com/. It uses the same checks as version 1.2 of the mysqltuner.pl script, but in a nice, friendly Windows application - no need to install Cygwin or Perl.
Ok so this is over a year after the question but I thought it relevant because you can actually still use the mysqltuner script if you combine it with Cygwin.
Install Cygwin
Make sure Perl is installed
Additionally I installed the mysql and the mysqld packages as well (Needed for the script to connect to a "remote" MySQL.
Copy the mysqltuner.pl script to your Cygwin user home directory (Found under cygwin_install_dir/home/your.user)
Start the Cygwin terminal
Run the script $ perl mysqltuner.pl --host mysql_host_ip --forcemem 512
If you encounter an error in the line of:
ERROR 1130 (HY000): Host 'somename.company.com' is not allowed to connect to this MySQL server
Go to the database server and add the appropriate user and privelages
You should now be able to use mysqltuner in a windows environment against local as well as remote MySQL servers.
...screenshots removed because I'm not allowed to use images yet, sorry.
Don't know of another tool (outside the MySQL Instance Configuration Wizard you can run) like mysqltuner which will not run unfortunately. You can install Perl on Windows, but when run the .pl file you will get an error about $PATH not having mysqladmin in it. Upon reading of the manual laughing, it plain as day states there is no Windows support for 1.2.0 version of tool.
You can see if these suggestions help in the interim:
http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/
Edit: I just found this: http://www.webyog.com/webyog/monyogscreenshots
MONyog, it is a paid product, though. I installed the trial and it looks very promising. It monitors your SQL server and gives you alerts and recommendations based on those alerts. Might be worth a look. I cannot vouch for too much other than it has some nice information in just a short period of time.

Using XAMPP Install of MySQL with Netbeans 6.8/MySQL Workbench

All,
For all of this I am using Mac OSX Snow Leopard.
I have happily used XAMPP to develop PHP backed sites in the past with no problems(as you'd expect for such a simple to set up package). I am now trying to set up this MySQL install in Netbeans 6.8 (for now just trying to get a sample database backed webapp to run). My issue is that even though MySQL has been started I cannot connect to it at 127.0.0.1 on port 3306 (which it is set up to use).
I have read that the issue is that XAMPP holds MySQl.sock in /Applications/XAMPP/xamppfiles/... whereas MySQL Workbench and Netbeans expects to find it in /tmp/MySQL.sock. Is this correct? I've tried to set up a symbolic link from /tmp to the xmapp directory but this doesn't appear to have changed anything.
Is there anything else I can try/anything that I am missing?
I upgraded from an older version of XAMPP to 1.7.3 and encountered a the same problem, I got MySQL Workbench to connect if I edited the my.ini file and:
changed the socket parameter to:
socket = "TCP/IP"
made mysql bind to an IP address or all IP as in the case below:
enable-named-pipe
bind-address=0.0.0.0
This requires that you disable named-pipe (as shown above)
I could not get this to work. So in case anyone else is reading this and wondering what happened... I installed a non XAMPP instance of the MySQL database and am using that now instead. Less than ideal but it works.