Help creating databases and users with MariaDB, Adminer

Hi everyone, I’m new to CasaOS, Docker and beginning to learn lots of new stuff using RPi 4B (4GB) with 256GB SSD connected via USB 3, but very conscious of all the stuff I don’t know!

I have installed CasaOS on the Pi and managed to change the casaos user password. Next I installed MariaDB and Adminer through the CasaOS app store. I have been able to connect Adminer to MariaDB and create a table in the casaos database as a test.

For my first project with CasaOS, I would like to log data from remote sensors which will (eventually, I hope) connect to MariaDB over my local LAN to insert their data into a database. I have previously built similar sensors using Arduino IDE to program Wemos D1 Mini development boards with sensors for temperature, humidity, barometric pressure etc, so I’m confident about that part of the project.

Now here’s the part I need help with today.

I would like to create a new database, instead of using the default casaos database that was created when MariaDB was installed. I would also like to create a new user which the remote sensors will use when they connect to the database. That way I can configure that user to restrict what it can do, specifically: only inserting data into a particular table in the new database.

However, I am unable to create that database and user, I get only Access Denied/Insufficient Privileges type error messages when I try. It seems like the casaos user isn’t privileged enough and I need to use root account but I’m not sure how to go about this.

Can someone please take me step by step through creating a new database and user?

I also have a concern about whether the remote sensors will be allowed to connect to the database over my LAN using this new user’s credentials, and how I permit that, so any guidance there would also be appreciated. I seem to remember that MySQL databases are difficult to connect to remotely and allow only connections from their local machine’s IP address by default, and knowing MariaDB and MySQL are closely related, think I might also face that problem.

Thanks,

Paul