Bug #15835 fix_privilege script does not find 'mysql' database
Submitted: 18 Dec 2005 15:05 Modified: 19 Dec 2005 8:24
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.17 OS:Windows (WinXP)
Assigned to: CPU Architecture:Any

[18 Dec 2005 15:05] Peter Laursen
I just upgraded from MySQL 5.0.16 to 5.0.17.  From the change-logs http://dev.mysql.com/doc/refman/5.0/en/news-5-0-17.html I can see that a change with privileges has taken place regarding views. So I thought I'd better run the fix_privlege script.

Doing so returned: 'No database selected'.

Next I issued: 'use mysql;' before running the script "SOURCE ...".  And now it looked/did 'as usual' while processing script and tables were updated.

How to repeat:
Log on as root with command-line client and run update script like explained here:

'No database selected' is returned.

Now issue 'use mysql:' and run script and tables are updated.

Suggested fix:
One of two (or both!):

Update the docs.  

include the appropriate USE -statement in the script.
[18 Dec 2005 15:15] Peter Laursen
Sorry .. the privilege issue is regarding triggers. Just fro correctnes! too late here I guess!

But it does not alter the point!
[18 Dec 2005 16:45] Peter Laursen
I now think that this problem is only related to the MySQL-client instance that the installer for Windows places in the Windows start-menu.

I also don't think it is a problem with 5.0.17 alone. It is the same for 4.0.16 as well. However 4.0.26 works fine.  But 4.0.x does not use the new Windows installer either, and no start-menu item is available.  So probably is is a general problem/phenomenon when starting the client from Windows start-menu, that no database is selected ??
[19 Dec 2005 8:24] Valeriy Kravchuk
Thank you for a problem report. Sorry, but that is not a bug, just documented way to run the script. Please, read the manual (http://dev.mysql.com/doc/refman/5.0/en/mysql-fix-privilege-tables.html) carefully:

"On Windows systems, MySQL distributions include a mysql_fix_privilege_tables.sql SQL script that you can run using the mysql client. For example, if your MySQL installation is located at C:\Program Files\MySQL\MySQL Server 5.0, the commands look like this:

C:\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql -u root -p mysql
mysql> SOURCE C:/Program Files/MySQL/MySQL Server 5.0/scripts/mysql_fix_privilege_tables.sql"

"mysql -u root -p mysql" means that you connect as root with password and use mysql database. If you omit "mysql" from the command line, surely you have to perfrom "use mysql" before running the script.