How do I automatically create users in mysql

Asked by:
MtKuile / 41 Points
Time:
2013-09-16 11:43 pm EST
Category:
Databases
Hits:
431
I would like new users to be automatically accepted to use my MySQL database service by having access rights to the MySQL database pre-set for every new registrant. How can I do that?

To ask this user for more information, please first login.

To submit an answer, please login.

ANSWERS

0

arnelc
Staff
17,314 Points
2013-09-17 12:23 am EST
Hello MtKuile,

Thanks for the question. Apologies but we do not provide coding solutions for requests of this nature. We do try to point you in the right direction. Your request would require that you have a way to input new users through a front-end interface. The user creation request would then automatically add the user with a preset access level so that they can access the database as required via other web-based interfaced that you would need to create. The database is a back-end component to the website, so you would need to create front-end interface that interact with your website visitors.

You can find more information on this type of issue by looking at Adding User accounts in Mysql. The programming for the front-end of the website will depend upon what you wish to use to develop these interfaces. For example, you could learn PHP5 or use HTML 5.

I hope this helps to get you the information you need to accomplish your programming goals.

Regards,
Arnel C.

To submit a comment on this answer, please first login.

0

JacobN
Staff
3,713 Points
2013-09-17 12:27 am EST
Hello MtKuile,

This wouldn't be possible as in order to create additional MySQL users you'd need to create a MySQL user in cPanel which can't be called directly from another script.

If instead you're using a CMS such as WordPress, these have the ability to allow users to register themselves to create users in WordPress. But if you're trying to grant users direct MySQL database access, this wouldn't be doable.

Please let us know if you had any further questions.

- Jacob

To submit a comment on this answer, please first login.

Since you host e-commerce websites (I have seen a shopping cart in your 3 customer packages), surely there must be a way to enable random users to register themselves on the website you are hosting, just as they do on any website that requires registration. Or does your answer mean that if a webhostinghub (potential) customer uses MySQL in his e-commerce website, he CANNOT be hosted on webhostinghub ? If so, this might be a major deterrent for becoming a webhostinghub client. The only alternative is, I reckon, that you also offer a software by which a customer can build an e-commerce site hosted by you. But still, this is not the best solution. A general-purpose script to do the above for MySQL databases (i.e. accept new user/password through the customer's front-end) - with a predefined rights profile on a specific database - should not be that hard to implement.
zolo.warno
3 Points

2017-02-02 1:31 pm EST
Instead of granting direct database access for each user; most e-commerce websites will have database access (via one user account). Then, you can add users to a "table" when they register for your site. Once they are added to the "users" table you can grant privileges, and set their access level. Examples of e-commerce software that functions like this are PrestaShop, WooCoommerce, OsCommerce, Magento, OpenCart, Zen Cart, etc.

This will absolutely work on our hosting.

If you want to create a database user, we recommend doing so in cPanel. This is covered in our guide How to Create and Assign a User to a Database.

If you really want to give users direct database access (this is not recommended) you should be able to accomplish this with command line via SSH.

Thank you,
John-Paul
johnpaulb-whh2
12,339 Points
Staff
2017-02-02 7:31 pm EST
Want to share this Question?
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 757-416-6627 Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}