Rails integration test: Mysql2::Error: Can't connect to MySQL server - mysql

Lately I am working on my beautiful tests, but suddenly, after a 2 days rest, I ran again my integration tests (rake test:integration) and they don't work anymore. I really didn't do anything.
What comes is the following error:
Mysql2::Error: Can't connect to MySQL server on '192.168.0.2'
The nice thing is that the server runs fine. It is just the integration test that is broken. And they use the same mysql database.
Any idea on how to solve the problem?
Luca

check your database.yml settings about test environment and then make in terminal
rake db:test:load

Check the DB using mysql workbench if you not find errors as user permissions... delete and create again DB for app. rake db:drop && rake db:setup

Related

ActiveRecord::StatementInvalid in Rails 4.2.7.1

On my local system, I am facing an error of Statement Invalid. Previously, I was not getting this, but I think when I reindexed my elastic search after adding the taxon_ids index, this error started to come. Please check the attached screenshot.
And version details are -
Mysql - 5.7.34-0ubuntu0.18.04.1
Rails - 4.2.7.1
Ruby - 2.3.1
Please advise on how it can be resolved.
The Error says that your Database is missing some columns. Can you run
rake db:migrate

Commands out of sync; you can't run this command now - error on TYPO3 backend module of EXT:indexed_search

In the production environment of my TYPO3 8.7 installation I get this error message when I try to open the TYPO3 backend module "Indexing":
Commands out of sync; you can't run this command now
Doctrine\DBAL\Driver\Mysqli\MysqliException thrown in file
/home/www/html-data/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php in line 280.
The problem seems to be in the loop in vendor/typo3/cms/typo3/sysext/indexed_search/Classes/Domain/Repository/AdministrationRepository.php in function getRecordsNumbers()
After some research it seems that closeCursor() is necessary, but I wasn't able to integrate that.
The funny thing is, that the error only occurs in my production environment. On the development machine, everything works fine!
So is this now a TYPO3 bug or a configuration problem of my production machine?
My environment:
TYPO3 8.7.20
Production:
PHP 7.2.8
MySQL 5.6.37
mysqlnd 5.0.12-dev
Development:
PHP 7.2.7
MySQL 5.5.60
mysqlnd 5.0.12-dev
Only difference is that in the development environment pdo_mysql is not present.
It turned out that the index of the database table index_rel was broken.
Deleting the table and rebuilding it solved my problem.

Cannot connect to Mysql From Rails Application

I am having my application and database hosted in EngineYard. Suddenly my application is down. I am getting this error when I looked into the log
Mysql2::Error: This connection is still waiting for a result, try again once you have the result
I tried to run some read queries from Rails console in Staging. This is working fine. Database queries returns the expected answers.
Also I checked out the Staging branch in local and checked. I could not reproduce the error in my local. So I assume there is no error in the code.
Restarting the App Server worked for me.
Syntax:
ey ssh "/engineyard/bin/app_<appname> restart" -e your_env_name --app-servers
Reference:
Engineyard command line: ey web restart not working

Connection problems with Rails and MySQL

So I was making some tests here on Rails and for first time I decide to use MySQL, I've setting up the gem mysql2 and the mysql server.
When I try to access the database I receive this:
ActiveRecord::ConnectionNotEstablished
The strange thing is I'm able to run the rake db:create and the migrations without any problems.
thanks in advance,
Renan
ActiveRecord::ConnectionNotEstablished
Raised when connection to the database could not been established (for example when connection= is given a nil object).
Try checking your db configurations in the config/database.yml file if everything is correct or not!!

Running rake migrate gives Mysql error schema_migrations.frm

I am running 5.1 on Ubuntu 10.04, and the remote server is running 5.0.51, is this a problem?
Mysql::Error: Incorrect information in file: './user/schema_migrations.frm': SELECT version FROM schema_migrations
I should say that trying to install it gives the error of the package (mysql-server-5.0 referenced but not available). I believe it is available in 9.10, but how can I add those repos to 10.04?
The migrations table on the remote database was corrupt. I had to rebuild it.