#1 (permalink)  
Old 04-12-2008, 03:23 AM
Registered User
 
Join Date: Feb 2005
Posts: 162
shacker23 is on a distinguished road
MySQL database / username connection

Hi -

If I run these .sql queries in this order:

Code:
CREATE DATABASE `username1_dbname`;
GRANT ALL ON `username1_dbname`.* TO 'username1_foo'@'localhost' IDENTIFIED BY 'lskdfj';
FLUSH PRIVILEGES;
It works. The user can now use this database, dbname, and db pass however they like.

But in cPanel's MySQL panel, the db account name and the database both appear, but don't appear connected - it appears as if that user has no grants on that db. I would assume cPanel would show the grant as already existing.

How can I run a series of SQL statement as above that not only works, but also displays properly in cPanel? What is cPanel checking for when displaying grants between db account names and databases?

Thanks,
Scot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-13-2008, 04:13 PM
Registered User
 
Join Date: Feb 2005
Posts: 162
shacker23 is on a distinguished road
OK - After much trial and error, I've solve this one. You need to escape the underscore in the GRANT statement line. You do NOT need to escape the underscore in the CREATE DATABASE line. Go figure. so this code gets it right (the change is in red below):

Code:
CREATE DATABASE `username1_dbname`;
GRANT ALL ON `username1\_dbname`.* TO 'username1_foo'@'localhost' IDENTIFIED BY 'lskdfj';
FLUSH PRIVILEGES;
I have no idea why this is necessary. Again, the original version works just fine, it's just that the graphical cPanel database admin user page does not show the connection between the username and the db name unless you do the escaping as above. Quirky.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:52 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc