Question Webmin: creating a new db with user, user permissin and so on: which sequence is the best!?

thedighubs

Member
Nov 21, 2024
167
17
41
hello and good day - good day dear frineds, :cool:

on a server 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..i have got a question:
which are the right steps and whhich is the correct sequence?

well in other words: what comes first - second - third ...?

btw: some of the net-ressources say like so;: found some here: https://www.trustfm.net/ebooks/DedicatedServer.php?page=MySQL

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.

what do you think is the right sequence - and
besides this: The question comes up to my mind. Why can ´t i go and create the whole stuf with some excel-commands that i enter in the excel-command form of Webmin!?

note: i am not on a CLI at the server. But i have the webmin - whereas i can run some SQL-commmands

look forward to hear from you🤩

regards
 

JackMDS

Elite Member
Super Moderator
Oct 25, 1999
29,552
429
126
I hope that you do not use sensitive Data on your installation.

Webmin is not considered highly safe software.
 
  • Love
Reactions: thedighubs

thedighubs

Member
Nov 21, 2024
167
17
41
Hello dear JackMDS;)

first of all : many thanks for the reply - for your answer and yes: for the sharing of your ideas. 👍
well i all ways thought that this would be pretty safe.

At the moment i am not at home - in front of the according machine that has access to the server - and the Webmin ( hmm - i think its Webmin and not (!)) Virtualmin - which is somewhat different - and the processes in the second - will be much much more automated - i have heard

i will come back later the day - and will give you more information

Meanwhile - many thanks for the answer - and for steppin up the plate :)

untill later ...
 

Fallen Kell

Diamond Member
Oct 9, 1999
6,208
537
126
I would also highly recommend not using webmin for mysql database operations and maintenance. For now, I would check what version of mysql your system is using and download the appropriate client to enable you to directly connect at the command line (it is possible that the admins who setup your access might not allow you to connect from a remote system and/or only from certain ones, so you may need to determine that as well from the webmin as well).

As for what you are trying to do, assuming you have the proper permissions for your account, use the command line to create a new database:

CREATE DATABASE IF NOT EXISTS your_new_database_name;

Then create the new user who has permissions to administer that database:

GRANT ALL PRIVILEGES ON your_new_database_name.* TO 'your_new_username'@'hostname';
FLUSH PRIVILEGES;

Replace hostname with something like either 'localhost' if you only allow the user to connect from the system/server that is running the database, or "%" if you want to allow them to connect from anywhere, but be careful of allowing from anywhere since you are opening up the system for someone to be able to make a remote connection in literally from anywhere in the world that can reach the IP of the system... If they need to access from more than one host, you run the "GRANT" command again with the additional hostname value.

You can change the "GRANT ALL PRIVILEGES" to just a list of specific privileges, such as "SELECT,DELETE,INSERT,UPDATE,CREATE,DROP,ALTER" PRIVILEGES. This is useful for having a user that is basically read-only, and others that can modify things.


If you are the one who installed mysql database, I would also highly recommend updating the default admin account "root" by looking for and removing the entry in the grant tables for that user:

USE mysql;
SELECT * FROM user;

Look at the above output and I would consider removing the entry for "root@'%'" if your system is connected to the internet... You can also remove the "root" user entirely, but only after you create a new username that has full admin privileges, otherwise you will need to re-install as no user can update entries or restore a backup (the GRANT command is slightly different, as you want to create a user that can also create other users, and the "ALL" PRIVILEGES does not include that, you need to include "WITH GRANT OPTION":

GRANT ALL PRIVILEGES ON *.* TO 'your_new_username'@'hostname' WITH GRANT OPTION;
FLUSH PRIVILEGES;
 
Last edited: