To create a database user for accessing the Manager database on an MLOS system, perform the following steps:
If you are using Manager version 10.1.7.4 or earlier -
Run the following commands to create a new database user.
Login to the Manager instance.
Switch to the restricted shell.
To switch to the restricted shell, use the
5n3ak1ncommand. After running the command, it will prompt for the root password followed by the admin password.Enable listening on port 3306.
#firewall-cmd --zone=public --permanent --add-port=3306/tcp#firewall-cmd --reloadComment the
bind-addressand theskip-networkingproperties in the/etc/my.cnffile.#bind-address=127.0.0.1 #skip-networking
Restart the mysql service.
#systemctl restart mysqldLogin to MariaDB as a root user.
#<Manager_Install_Dir>/MariaDB/bin/mysql -u root -pRunning this command will prompt you to enter the root password of the database. On successful login, you will get the MariaDB prompt and in the prompt, run the
use mysql;command.Create the required database user.
>create user <new user name of the database>@<IP address of the system from which the user will connect to the database> identified by '<password>';For example:
>create user ipstst@192.168.1.20 identified by 'ipstp';Provide read only access to the newly created database user.
>grant select on lf.* to ipstst@192.168.1.20;Verify if the creation of the database user is successful.
SELECT User FROM mysql.user;
If you are using Manager version 10.1.7.7 or later -
Run the following commands to create a new database user.
Login to the Manager Shell.
Execute the command
dbShell. Enter the DB username and password, when prompted.The prompt changes to
Please enter the SQL query you want to execute:when you successfully login to the dbShell.Create the required database user.
CREATE USER '<username>'@'<hostname>' IDENTIFIED BY '<password>';For example:
>CREATE USER user1@localhost IDENTIFIED BY 'test123';whereuser1is the name of the user being created,hostnameis localhost, andpasswordprovided is test123.Note
The default hostname is localhost.
Grant required permission(s) to the user.
GRANT priv_type ON priv_level TO 'username'@'hostname';Replace
priv_typewith the type of privilege (such as, SELECT, INSERT, UPDATE, or ALL) you want to grant to the user,priv_levelwith the level at which the privilege should apply (that is, database.table), and username and hostname with the values you used in the CREATE USER statement.For example:
GRANT SELECT ON testdb1.* TO user1@localhost, where read-only access is provided to user1 in the database named testdb1.Flush privileges so that the user permissions can take effect.
FLUSH PRIVILEGES;Verify if the creation of the database user is successful.
SELECT User FROM mysql.user;Execute the command
exitto exit the dbShell prompt.