Project

General

Profile

Bug #767

phpmyadmin - fail to install if database exists

Added by sag47 about 10 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Medium
Assignee:
-
Category:
-
Target version:
-
Start date:
02/16/2011
Due date:
% Done:

0%


Description

phpmyadmin fails to install if the user phpmyadmin and database phpmyadmin already exist. It should be dropped or IF NOT EXIST then add user. I had previously installed phpmyadmin but circumstances required me to run install -f to reinstall my HDA. So the database entries for that particular app was left over.

Here's /var/log/amahi-app-installer.log on the issue.

======= app install begin @ Wed Feb 16 10:33:06 -0500 2011 ==========
Installing app id fqzjgts9lz under /var/hda/platform/html ENV=production
NOTE: file /tmp/amahi-download-cache/1da3f892a89a6e2ebd53958f77f0ef69dc86927c picked up from cache.
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log': Mysql::Error: Operation CREATE USER failed for 'phpmyadmin'@'localhost': create user 'phpmyadmin'@'localhost' IDENTIFIED BY 'phpmyadmin' (ActiveRecord::StatementInvalid)
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/mysql_adapter.rb:319:in `execute'
    from /var/hda/platform/html/script/../app/models/db.rb:32:in `before_create_hook'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `evaluate_method'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:in `call'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:93:in `run'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in `each'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in `run'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:276:in `run_callbacks'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/callbacks.rb:344:in `callback'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/callbacks.rb:265:in `create'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2867:in `create_or_update_without_callbacks'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/callbacks.rb:250:in `create_or_update'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2538:in `save_without_validation'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/validations.rb:1078:in `save_without_dirty'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/dirty.rb:79:in `save_without_transactions'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:229:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:182:in `transaction'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:196:in `save'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:196:in `save'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:723:in `create'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/reflection.rb:169:in `create_association'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations/belongs_to_association.rb:5:in `create'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations/association_proxy.rb:145:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations/association_proxy.rb:145:in `send'
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations.rb:1347:in `create_db'
    from /var/hda/platform/html/script/../app/models/app.rb:213:in `install_bg'
    from /var/hda/platform/html/script/install-app:91:in `install_or_uninstall'
    from /var/hda/platform/html/script/install-app:112:in `main'
    from /var/hda/platform/html/script/install-app:124

History

#1 Updated by sag47 about 10 years ago

  • Priority changed from Normal to Medium

When I clicked install on phpmyadmin in the apps page it would stop infinitely on Preparing to install ...

If you refreshed the page then Install >> would show up again. If you clicked Install >> it would do what I stated above.

Then I resolved this by.

$ su
# mysql -u root -phda
DROP DATABASE phpmyadmin;
DROP USER 'phpmyadmin'@'localhost';
quit;
# rm -rf /tmp/amahi-download-cache/1da3f892a89a6e2ebd53958f77f0ef69dc86927c

Go to the apps page and install normally. It will complete.

#2 Updated by bigfoot65 about 10 years ago

This is due to a improper uninstall of the app. Need to consider modifying the database creation for app installs to check for existing db and remove if present.

This is not something specific to phpMyAdmin. It could occur to any application.

#3 Updated by cpg about 10 years ago

i assume this is on fedora 14?

the current platform clearly only creates the db if it does not exist:

from app/modes/db.rb

c.execute "create database if not exists `#{name}`" 

we need the full history of what went on here to determine why the statement of creating a user was not valid.

something/someone may have created the user, so this failed:

c.execute "create user '#{user}'@'#{host}' IDENTIFIED BY '#{password}'" 

it would appear that this user was there already in the db.

if this was not created by a human and it was due to this app being installed and uninstalled improperly, why did the app install fail in a prior install to this one that failed?

#4 Updated by cpg about 10 years ago

Wait a minute .. Why does phpmyadmin need a user and db?

It uses the root user of mysql!

No need for a db or user, I'd say!

#5 Updated by sag47 about 10 years ago

Yes, this is on Fedora 14. I forgot to mention that. I don't know why phpmyadmin needs a user. That is the error message I got. I assume it is for reading/writing its own settings.

#6 Updated by bigfoot65 about 10 years ago

There is some configuration information loaded in a database for the application. This relates specifically to the app and is done my design.

#7 Updated by bigfoot65 about 10 years ago

bigfoot65 wrote:

There is some configuration information loaded in a database for the application. This relates specifically to the app and is done by design.

#8 Updated by bigfoot65 about 10 years ago

bigfoot65 wrote:

bigfoot65 wrote:

There is some configuration information loaded in a database for the application. This relates specifically to the app and is done by design. It adds additional functionality to the app.

#9 Updated by sag47 about 10 years ago

cpg wrote:

i assume this is on fedora 14?

the current platform clearly only creates the db if it does not exist:

from app/modes/db.rb
[...]

we need the full history of what went on here to determine why the statement of creating a user was not valid.

something/someone may have created the user, so this failed:

[...]

it would appear that this user was there already in the db.

if this was not created by a human and it was due to this app being installed and uninstalled improperly, why did the app install fail in a prior install to this one that failed?

This is when you logged in debugging errors I had encountered during my first install. I had previously installed phpmyadmin before you started debugging. Then we both ran the install -f command. phpmyadmin was no longer installed. So I installed it again and got that error. I resolved it by running the database commands.

That's the whole process to my knowledge.

#10 Updated by cpg about 10 years ago

i am still confused

I had previously installed phpmyadmin before you started debugging.

by hand or as an app. if as an app, you have to provide the installation log for the previous install, please, otherwise it's impossible to tell what went on.

install -f? where?

#11 Updated by sag47 about 10 years ago

cpg wrote:

i am still confused

I had previously installed phpmyadmin before you started debugging.

by hand or as an app. if as an app, you have to provide the installation log for the previous install, please, otherwise it's impossible to tell what went on.

install -f? where?

I meant the only force install for reinstalling the HDA. hda-install -f [CODE]. That one.

Here's my amahi-app-installer.log... http://fpaste.org/A86n/

It's the only one I have.

#12 Updated by bigfoot65 about 10 years ago

Could this be an isolated incident? I have not seen or heard anyone else having this issue as of yet. The only way I know of a user and db sticking around is when the app is not properly uninstalled.

Would reinstalling Amahi after the app was already installed cause this behavior? It seems possible, but unsure if it can be duplicated.

#13 Updated by sag47 about 10 years ago

bigfoot65 wrote:

Could this be an isolated incident? I have not seen or heard anyone else having this issue as of yet. The only way I know of a user and db sticking around is when the app is not properly uninstalled.

Would reinstalling Amahi after the app was already installed cause this behavior? It seems possible, but unsure if it can be duplicated.

Not sure. I've given all of the information associated with this incident I have left to give. So if it is isolated then no big deal. If not we'll hear from others I guess.

#14 Updated by bigfoot65 almost 10 years ago

Please try this app again and report progress. It has been updated and all tests indicate positive results with no errors.

#15 Updated by bigfoot65 over 7 years ago

  • Status changed from New to Closed

No longer valid.

Also available in: Atom