Regenerate YML mapping issue in Symfony 2.4 - mysql

Running a Symfony 2 project, I have recently made a change in my MYSQL database, and I would like to update my schema and model structure inside my symfony project so I can use the new items that are in it.
This is what I try to do from a running instance in production:
php app/console doctrine:mapping:import --force CoreBundle yml
Here is the error I get:
[PDOException] SQLSTATE[HY000] [2002] Connection timed out
Core/Bundle exists and was already mapped this way by the past
Also note that the server is up and running, doing exchanges with the database
I cannot find a place where to see a more detailed log. Tried to configure the config.yml to add logging for doctrine but it doesn't give me more infos
Thanks in advance

Since I didn't found the source of the problem, I just deployed a new symfony app, connected it to the database and then just generated orm + entities by following the same commands. After that I just copied the /Entity folder and /orm folder and replaced it on my production env. A bit messy but it worked

Related

Symfony - App uses wrong database name, CLI uses the correct one

hoping to get help with possibly a silly problem. I can't get Symfony to connect to the correct database.
My config line in .env is as follows
DATABASE_URL="mysql://root:root#127.0.0.1:3306/main?serverVersion=mariadb-10.4.27"
Creating a database using CLI works just fine and the database named "main" is created
bin/console doctrine:database:create
Created database `main` for connection named default
Running migration works OK and a table is created in the database
bin/console doctrine:migrations:migrate
WARNING! You are about to execute a migration in database "main" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
> yes
[notice] Migrating up to DoctrineMigrations\Version20230117183120
[notice] finished in 28.6ms, used 22M memory, 2 migrations executed, 3 sql queries
Yet, when I try to access the site from the browser I get the following error
An exception occurred in the driver: SQLSTATE[HY000] [1049] Unknown database 'root'
Clearing the cache doesn't seem to help, I don't see any reference in the code to a database named root. Any clues on how to make Symfony to connect to the "main" database?
Cheers
P.

MySQL and Keycloak setup

Hello I am trying to add mysql database in my Keycloak server.
I've added module.xml and mysql-connector-java-5.1.42-bin.jar under /modules/system/layers/base/com/mysql/main.
When I am running the command to add mysql module,
./jboss-cli.sh, it errors out with
Exception in thread "CLI Terminal Connection (uninterruptable)"
java.lang.ArithmeticException: / by zero
And when i am trying to start Keycloak, I am also notified that there is a missing service.
service jboss.jdbc-driver.mysql (missing)
Please help!!
When I am running the command to add mysql module, ./jboss-cli.sh, it errors out with
Can you post your Command? You dont't have to do this with the cli. It's also possible to modify the config in a editor. At least for testing you should try this.
Keycloak docs have a pretty good part about database setup: https://www.keycloak.org/docs/latest/server_installation/index.html#_database
The basic steps are:
Locate and download a JDBC driver for your database
Package the driver JAR into a module and install this module into the server (module.xml)
Declare the JDBC driver in the configuration profile of the server (standalone.xml)
Modify the datasource configuration to use your database’s JDBC driver
Modify the datasource configuration to define the connection parameters to your database
There is an error in the Keycloak documentation. Driver should be in the
modules/system/layers/base/com/mysql/driver/main
folder.
The full valid instruction is here
https://github.com/v-ladynev/keycloak-nodejs-example#keycloak-configuration
Also you can use docker images to experiment
https://github.com/v-ladynev/keycloak-nodejs-example#keycloak-docker-image

Hmailserver database version could not be detected

Okay so I'm trying to install HMailServer on my Windows 7 PC with XAMPP, and connect it to the MySQL database in XAMPP. I've been Googling for hours and only finding either ineffective or invalid answers.
I went through the installation to the database set up and selected:
Select a new Hmail server default database
MySQL
Database Server address: E6400, port 3306, Database name: Douglas (All correct I checked it out in PHPmyadmin) Then I typed in my Username and password for a user that I granted all privileges too on the database...
Left service dependency blank
Then on the finish screen it returned
Starting task...
Please wait while updating database settings...
Settings updated.
Restarting server...
Database version could not be detected.
I did place a libmysql.dll file in the hmail server bin (not one from XAMPP because I couldn't find one in there).
Here's my error logs:
"ERROR" 5460 "2015-06-26 21:34:37.341" "Severity: 2 (High), Code: HM5033, Source: DALRecordset::Open, Description: MySQL: Table 'email.hm_dbversion' doesn't exist (Additional info: select * from hm_dbversion)"
"ERROR" 5460 "2015-06-26 21:34:37.341" "Severity: 1 (Critical), Code: HM5010, Source: Application::OnDatabaseConnected, Description: Database version could not be detected."
Do I need to manually create the table .hm_dbversion or something? Let me know if I need to include more information. Thanks everyone!
Just ran into this same issue. This is how I resolved it. There may be a better method to do this but this is what worked for me:
Run the installer and tell it you want to use a different database (MySQL).
Once the installer gets to the step where you setup the database, just cancel the database setup.
Open you hMail folder (C:\Program Files (x86)\hMailServer\DBScripts)
Locate the 'CreateTablesMYSQL.sql' file.
Use a MySQL database editor to create a new schema and execute the above sql file into that new schema.
Next, open the hMail database setup app. (C:\Program Files (x86)\hMailServer\Bin\DBSetup.exe)
Go through the steps to setup your MySQL database using the new schema you just created as the database.
If all was done well, you should fly thr

rails deploy - database not uploading

I'm working on my first rails app deploy and the database data from my local computer doesn't seem to be getting loaded into the database on the server when I deploy with capistrano. I'm not clear as to whether capistrano takes care of this or not. I have also tried running 'rake db:schema:load' from the /current release directory. Here's the log of what happens when I try to load the app (on the remote webserver) in a browser.
Started GET "/" for XX.XX.XX.XX at 2012-04-04 13:26:46 -0700
Processing by PagesController#home as HTML
Completed 500 Internal Server Error in 3ms
ActiveRecord::StatementInvalid (Mysql::Error: Table 'project.users' doesn't exist: SHOW FIELDS FROM `users`):
app/models/user.rb:61:in `authenticate_with_salt'
app/helpers/sessions_helper.rb:50:in `user_from_remember_token'
app/helpers/sessions_helper.rb:13:in `current_user'
app/helpers/sessions_helper.rb:17:in `signed_in?'
app/controllers/pages_controller.rb:5:in `home'
So the problem seems to be that the app loads, but the DB isn't populated with tables and data.
I'm sure I'm missing a relatively basic detail of the deployment process, but thus far it escapes me... Any help would be mucho appreciated! Thanks.
What does your Capfile look like?
Neither Rails nor Capistrano will copy data from your development environment to your deployment environment—db:migrate:* and db:schema:* only handle database structure. Before using rake db:schema:load make sure your development environment migrations have been run and your latest db/schema.rb is checked in to your repo.
If you want certain data to be in your database upon deployment look in db/seeds.rb. There are also many gems for seeding database data.

symfony database access configuration problem

I just joined a web dev project that uses Symfony 1.4 on CentOS 5.4 with MySQL. The server is down. My first task in the project is to get it back up. I don't know a lot about Symfony.
The Apache server log says
Access denied for user 'root'#'localhost' (using password: NO)
From all I can tell, the database access configuration is stored in
/var/www/html/<project name>/config/databases.yml
and for some reason, there's also some config in
/var/www/html/<project name>/config/propel.ini
There was no password for user root in either of the files, so I thought adding it and restarting Apache would finx the issue. It does not, the error message stays the same. I might be looking at the wrong config files, but I can't find any other.
Any wild guesses how to fix this ?
Cheers,
ssc
OK, I know now what I did wrong: The password indeed has to be added to databases.yml, but whenever the configuration is changed, the symfony cache needs to be cleared by executing
./symfony cc
in the /var/www/html/<project name>/ folder.
You are right, the database config file is stored at /WEB/project/config/databases.yml
You can also try to run the configure:database command from the symfony command line tool.
php symfony configure:database "mysql:host=DBHOST;dbname=DBNAME" USER PASS
A getting started guide, and much more can be found at: http://www.symfony-project.org/jobeet/1_4/Propel/en/