The sequence of the creation of a db, a user, the according permission and all that sort of things!?

OpenSuse N
OS type and version 19xy
Webmin version 19 xyz

good day dear experts hello dear webmin developer and frineds,

i am running webmin
btw: finally was able to step through all the steps of creating a new vhost

now for the creation of a mysql-db with user, user permission and so on..
which are the right steps and whhich is the correct sequence -

in other words: what comes first - second - third …

btw: some of the net-ressources say like so;:

first: Now go to Servers > MySQL Database Server.
Click the “Start” button in order to start the database server.
Now click the link “Create a new database”.

next …: create a new “User”

third: …After the user creation Webmin will lead you at the “User Permissions” page where you should have the newly created user userwebsite1db1 like the picture below.

forth: … click at the “Return to database list” list located at the bottom of the page.

Finally we have to assign the userwebsite1db1 user at our website1db1 database.
Click at the “Database Permissions” icon. Hit the link “Create New Database Permissions.”

Now fill the "Create Database Permissions" form like this :
Databases : selected website1db1
Username : userwebsite1db1
Host : localhost
Permissions : ALL (use the CTRL key in order to enable multi-select)

Hit the "Create" button.

and subsequently … click at the “Return to database list” list located at the bottom of the page.
At this point we have finished with MySQL setup and configuration.

**questions that arise: **

  • is it correct to use the db first or shouldnd i create a user at the first step!?
  • what if i enter in the Create-DB-Section

Host: from Host Permission Any … what if i choose here any instead of localhost

Question: can this be done!? Is it possible to choose here any and afterward in the credentials of the setup of - eg a wordpress site - i can choose localhost?

love to hear from you

Sounds like you should be using Virtualmin?

Virtualmin also creates a database user and the correct permissions for that user for their own database(s).

1 Like

You’re also installing WordPress? Definitely should be using Virtualmin for this.

To be clear, you’re certainly welcome to do everything manually if you want to for educational purposes or whatever. But, it sounds like you’re doing all the things Virtualmin does automatically in the most painstakingly slow and complicated and error-prone way with a goal in mind…you could get to the goal in a few clicks with the right tool.

Start with a freshly installed supported OS and install Virtualmin using our install script: Downloading and Installing | Virtualmin — Open Source Web Hosting Control Panel

1 Like

good day dear Joe :slightly_smiling_face:

  • thank you for your reply. Well i am not in front of the according machine - where i hav access - but i will be definitly later the day. then i will give you concrete information according the

name: webmin or Virtualmin and besides that
version of the Software

note: well i was talking to you several times - we discussed the right sequence in creating the db, the user, the permissin (for db, host and user).

i have had some issues with the process - i some times messed up the process and the creatrion - and belive it or not:

sometimes i added just one or two instances of new DBs (databases) to an allready exisiting user.

My admin told me that this is not a good practice - that this shouldn 't be done so. he told me t o seperate all tha stuff

of which the backend is maintained by a good friend of mine. Well i for one - can setup the webmin - and of course the database.

question: which steps to take while setting up a new db on Webmin
well which things have to be done first: should i first :

a. create a user
b. create a db
c. create a user-permission
d. create a host permission
e. create a db-permission

well is there any concrete order - or a way to do that processes? In other words: is there any concrete order?

But - as mentioned above - ATM i am not at home in front of the machine that has access to the server. When i am at home later the day then i will give much more infos about the software the process and where it fails at the moment.

For now - many thanks for the answer, for your continued support and for creating Webmin and Virtualmin

untill later

greetings
dhubs :wink: :slightly_smiling_face:

It doesn’t matter what order you create the user or database. Databases are not “owned” by users, you grant permissions to users.

You’re right, we have already had this conversation. So why are you still asking what order to create the user and database?

1 Like

good day dear Joe

so now i am at home: I run Webmin (!)
cf. System Information:
Webmin version 2.402

a.> It doesn’t matter what order you create the user or database. Databases are not “owned” by users, you grant permissions to users.

b.> You’re right, we have already had this conversation. So why are you still asking what order to create the user and database?

i an not on Virtualmin - i think that Webmin should be able to work - and that saii . i will try the setup again..

note: some trials ended up in a little mess.

Since two weeks i rnn a new versin - i guess the actual. I guess that some proceses now are smoother - and perhaps without forme behaviour

i come back here - if i run into trouble

greeting

Webmin can “work”, but you’re doing a bunch of unnecessary work in areas that seem uncomfortable for you. If you want to learn about databases, and how to manually manage everything, I’m not here to stop you. But, you seem to be struggling, so I’m telling you that Virtualmin easily solves your immediate problem of “I want a website running WordPress with a user and a database and a database user specifically for that application, with exactly the right permissions for that purpose”.

A new version of Webmin? Why would you expect processes to be “smoother”? Webmin does what it’s always done. It provides a general purpose systems management UI for UNIX/Linux systems. It does not automate creating websites and the services related to those websites…that’s what Virtualmin is for.

If you want this to be easy, use the right tool. If you want to learn the intricacies of how databases work, you’re going to need to read some documentation and do some experimentation. And you probably shouldn’t do that on a system you intend to put into production until you’re more comfortable with the tools.

It really feels like you just don’t want to use the right tool for the job, and I don’t understand why? Virtualmin is free. It is easy to install (on a freshly installed supported OS). It does everything you want to do automatically and without you needing to care which one you create first (though it still doesn’t matter).

1 Like

good day dear joe :innocent:

well as i mentioned. i have messes up some things during the manual creation process several times. .. now i am going to start again..

  1. Create the database first Servers MySQL, Database Server, Create new database.
  2. Create a new user with username + password.
  3. Assign that user to the database under User Permissions give at least ALL PRIVILEGES if the app needs full access.
    That’s it DB User Permissions.

so far so good: one qestion: what About the host - do i Need to take care for the host?

as mentioned allready: i am generally creating dbs for WordPress - on Vhostws.
well the WordPress site needs remote DB access, change ‘localhost’ to ‘%’ (but again, only if necessary).

regarding the SQL-STATEMENT-Method - (instead of doin it manulally)

unfortunatly i donot have such “Execute SQL Globally in Webmin”: This would be the place where i could run the full SQL sequence (database + user + grants).
I only see the per-database SQL editor - then the question is: can i still run CREATE DATABASE and CREATE USER there

Assumption; MySQL doesn’t care which DB we’re “in” when running those commands, because they’re server-wide statements.

if ist stands so - then i could use the following SQL Template:

a reusable SQL snippet to run in the Webmin SQL editor (global or per-database, both will work)

i donot have such “Execute SQL Globally in Webmin”: This would be the place where i could run the full SQL sequence (database + user + grants).

…a reusable SQL snippet to run in the Webmin SQL editor (global or per-database, will both work !?): i am not sure!

Can you help out. is this possible!?


-- STEP 1: Create the database
CREATE DATABASE IF NOT EXISTS `__DBNAME__`
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

-- STEP 2: Create the user (replace password!)
CREATE USER IF NOT EXISTS `__DBUSER__`@'localhost'
  IDENTIFIED BY '__PASSWORD__';

-- STEP 3: Grant permissions for WordPress
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP
ON `__DBNAME__`.*
TO `__DBUSER__`@'localhost';

-- STEP 4: Apply changes
FLUSH PRIVILEGES;

-due to the fact that i unfortunatly do not have such “Execute SQL Globally in Webmin”:

Tis would be the place where i could run the full SQL sequence (database + user + grants).

Can i run this SQL-Statement in the per-Database-Execution-widget!

look forward to hear from you

Joe has answered your original question about the sequence. He said that the sequence is not important. Webmin does not prevent a user from accessing a database if the user was created after the database was created. And vice versa. So dont worry unduly about sequence.

Please start a new topic if the original topic has been covered, do not discuss multiple topics in the same thread. This helps the community in future searches for information. See:

The best thing for you to do would be to switch from Webmin to Virtualmin. You will then be able to host websites like a champ and WordPress with a single click.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.