/    Sign up×
Community /Pin to ProfileBookmark

How to create database users, etc

Hi,

Can someone pls let me know how to create MySQL users and assign users to created databases.

Ideally with plain SQL queries, instead using CPanel scripts etc.

Thank you.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 24.2011 — Just in case: be aware that many web hosting plans to not allow you to create users via scripts: you have to use whatever control panel mechanism they give you for doing so. But if that is not an issue for you, see:

[url=http://dev.mysql.com/doc/refman/5.1/en/account-management-sql.html]Account Management Statements[/url]
Copy linkTweet thisAlerts:
@GUIRauthorJan 24.2011 — Thanks for the reply and as you said, it seems to be blocked by the web host.
Copy linkTweet thisAlerts:
@NogDogJan 24.2011 — Thanks for the reply and as you said, it seems to be blocked by the web host.[/QUOTE]

Yeah, what they normally do is only grant permissions for creating databases and users to the MySQL user that their control panel tool uses -- no other DB users can be given those permissions. It can be a bit of a pain, but it is probably a good security configuration, especially in any sort of shared hosting situation where multiple site users are using the same DB host.
Copy linkTweet thisAlerts:
@Store_DeveloperJan 25.2011 — Here is the simple method of create users by command line..just follow instructions.

http://dev.mysql.com/doc/refman/5.5/en/adding-users.html

Database Development Resources
×

Success!

Help @GUIR spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...