Bug 225052 - Wrong MySQL GRANT hint
Summary: Wrong MySQL GRANT hint
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.2.0
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2010-01-31 21:34 UTC by nimok
Modified: 2010-03-15 07:22 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nimok 2010-01-31 21:34:29 UTC
The MySQL command proposed by Amarok "GRANT ALL ON amarokdb.* TO 'user'@'host' IDENTIFIED BY 'pw';" to grant the MySQL user access to amarokdb does not work for non-local hosts. Amarok replaces 'host' by the specified hostname of the MySQL server. However in the above command 'host' should be the name of the client Amarok is running on.
Comment 1 Myriam Schweingruber 2010-02-01 10:34:14 UTC
Please upgrade your Amarok version to 2.2.2 and try again. See also http://kubuntu.org/news/amarok-2.2.2
Comment 2 nimok 2010-02-01 11:19:03 UTC
The problem persists with Amarok 2.2.2.
Comment 3 Myriam Schweingruber 2010-02-01 11:51:22 UTC
Thank you for your feedback.
Comment 4 Jeff Mitchell 2010-02-01 13:46:42 UTC
This is perfect for a junior job, if anyone is interested.
Comment 5 Anirudh S 2010-02-14 14:59:25 UTC
I am interested. I need some time though...
Comment 6 Radu Benea 2010-03-14 09:40:15 UTC
on my machine GRANT ALL PRIVILEGES ON ... was required intead of just GRANT ALL ON
Comment 7 Jeff Mitchell 2010-03-14 16:06:08 UTC
OK, and what machine is that? What version of mysql, what distro and version, what's the configuration like?
Comment 8 Jeff Mitchell 2010-03-15 02:28:56 UTC
MySQL reference manual says that "PRIVILEGES" is optional (http://dev.mysql.com/doc/refman/5.1/en/grant.html) but I'll change it anyways.
Comment 9 Jeff Mitchell 2010-03-15 02:37:31 UTC
commit 7acf6eba0ff9ce4f9c2828bee5d94efb24763053
Author: Jeff Mitchell <mitchell@kde.org>
Date:   Sun Mar 14 21:34:33 2010 -0400

    Change the MySQL commands for better wording and to remove host restrictions.
    
    BUG: 225052

diff --git a/ChangeLog b/ChangeLog
index c9f960b..96fe203 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,9 @@ VERSION 2.3.1-Beta 1
   CHANGES:
      * Allow moodbar files witout the leading '.' (both .<trackfilename>.mood 
        and <trackfilename>.mood now work) 
+     * Change example SQL command for setting up an external database to remove
+       (sometimes incorrect) host name and possibly fix some random regression in
+       some MySQL versions. (BR 225052)
 
   BUGFIXES:
      * Cover fetcher: Fixed a crash involving reappearing cover found dialogs
diff --git a/src/configdialog/dialogs/DatabaseConfig.cpp b/src/configdialog/dialogs/DatabaseConfig.cpp
index 5b2130b..68885ad 100644
--- a/src/configdialog/dialogs/DatabaseConfig.cpp
+++ b/src/configdialog/dialogs/DatabaseConfig.cpp
@@ -91,10 +91,9 @@ DatabaseConfig::updateSQLQuery() //SLOT
 
         // Don't print the actual password!
         const QString examplePassword = i18nc( "A default password for insertion into an example SQL command (so as not to print the real one). To be manually replaced by the user.", "password" );
-        query = QString( "GRANT ALL ON %1.* TO '%2'@'%3' IDENTIFIED BY '%4';\nFLUSH PRIVILEGES;" )
+        query = QString( "CREATE DATABASE %1;\nGRANT ALL PRIVILEGES ON %1.* TO '%2' IDENTIFIED BY '%3'; FLUSH PRIVILEGES;" )
                    .arg( kcfg_Database->text() )
                    .arg( kcfg_User->text() )
-                   .arg( kcfg_Host->text() )
                    .arg( examplePassword );
     }
     text_SQL->setPlainText( query );
diff --git a/src/configdialog/dialogs/DatabaseConfig.ui b/src/configdialog/dialogs/DatabaseConfig.ui
index 568feca..5df65ad 100644
--- a/src/configdialog/dialogs/DatabaseConfig.ui
+++ b/src/configdialog/dialogs/DatabaseConfig.ui
@@ -172,7 +172,7 @@
          <item>
           <widget class="QLabel" name="label_SQL">
            <property name="text">
-            <string>Access rights can be assigned with the following S&amp;QL commands (after replacing the password with the correct one):</string>
+            <string>If your database is not already set up, you can use the following S&amp;QL commands (after replacing the password with the correct one):</string>
            </property>
            <property name="wordWrap">
             <bool>true</bool>
Comment 10 Radu Benea 2010-03-15 07:22:47 UTC
It's mysql-5.0.88 on gentoo amd64.

Just retested, if I type without PRIVILEGES all privileges get set to not allowed.
Although mysql says it's optional.