Can't connect to local MySQL server through socket on new openshift - mysql

I am trying to set up the same instance of redmine I had running on the old openshift. I have set up everything as far as I understand but I am not great at this and I think I have configured the database incorrectly.
My database config is here
https://github.com/Dunkhan/Redmine/blob/master/config/database.yml
The error I get is
Mysql2::Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I know there are a lot of questions already posted with this error but most of them involve php so none of those solutions are applicable, in addition, these questions are mostly several years old and openshift has completely changed recently. I tried some of the solutions like changing to root user for mysql, and adding in the port to the config, but nothing has worked so far.

Related

Missing mysql.sock while connecting mysql in Centos

I'm trying to connect to mysql in Centos. I was using this normally. But this morning i wasn't able to connect. Looked through various links on internet and got to know i'm missing mysql.sock. I looked through find command but all in vain.
Error:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Not exactly answer. But reverted back to previous state using snapshot. And problem got solved.

Problems with mysql config - want to understand

i know that there are many questions which are connected with my question, but nothing helps me to come to my goal.
I'm on mac osx 10.10.4
in the past i had MAMMP installed on my mac. Later i deleted it to configure my local hosts by my own. In the meantime i use vagrant for this. But i want to understand how the local mysql config works.
My problem:
If i type "mysql -uroot" i get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
The /Applications/MAMMP/.. folder are deleted and not there. So i think there must be a config file where this is inserted. But i cant find this file. Not in /etc/my.cnf and not in /usr/local/mysql/support-files/... nowhere...
Could anyone give me hints where my config for that is destroyed and how i can reapair it?
Would be great to hear from you guys. Thanks

Wordpress site is using many connections to mysql

We have a website running on Wordpress which connects to mySQL database. Wordpress is using many connections, more than 100 and it is not closing them. We tried to close the connection inside the destructor of wordpress db connection. It has helped to some extent, but the connection count is still high. When 3 people connect the site, the connections count is going above 100. Can anyone help us in troubleshooting the issue?
We are using mySQL 5.6 and WordPress 3.9.1
Install the Wordpress DB Driver, set to PDO, and add PDO::ATTR_PERSISTENT to your initial connection constructor. This will use the same connection for all subsequent connections that connect using the same credentials.

Could not get database metadata for mysql on osx

I have a mysql database with 3000 tables, and a hibernate application. It working fine on ubuntu, but on Mac(homebrew) always show connection errors after
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000319: Could not get database metadata
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
I doubt some setting for mysql need to be change, but do not know which one.
Looks like your database server isn't responding.
Check the configuration files for hibernate and make sure that it's pointed at the right host for the database.
If you're using localhost, make sure that the mysql server you're running locally is up (ps or mysql command should help here) and verify that hibernate is either communicating over the UNIX socket, or that you have networking turned on in your local server (since by default it's usually off and required for TCP/IP access, even to localhost).
Fixed after added 'max_allowed_packet=20M' to my.cnf

mysql.sock and rails

This is not necessarily a programming question, but this issue is definitely blocking development (not to mention that there are thousands of questions on stackoverflow related to this, but none that I can see that address the issue I'm dealing with).
I've been working with rails and mysql for several months. At the time I did the install, all was fine, and up until about a week ago, I was able to run migrations, phpmyadmin, etc. without any problems.
Today, I was trying to create a new application (following the railscast 323). I also use Rubymine for an IDE.
I created the project using the IDE, project.new and created a new Rails application. I then proceeded created the scaffolding along with a migration file. I then did rake db:create and it seems as if the DB was created. When I tried doing rake db:migrate, I got the following error:
'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
I checked my config/database.yml (the file was created by the IDE) and it does have
socket: /tmp/mysql.sock
Additional information:
There is a /usr/local/var/mysql/store_development directory, so it seems as if the database was created.
I can go to /localhost/phpmyadmin, but my root password is not accepted (I did not change the root password)
I have not re-installed mysql
I have not updated mysql
/tmp/mysql.sock no longer exists
/usr/var/mysql/mysql.sock does not exist
Any ideas?
First of all, make sure mysqld is running.
If yes, try this:
ln -sf $(locate mysql.sock) /tmp