Steps to Access MariaDB for ERPNext Production VM

Hello,

I have installed the Production VM of ERPNext.
Is there any clear step-by-step document to access the DB using Mysql Workbench or any other tool?

I looked for a solution through tens of documents and failed for many reasons;
steps, not complete
data such as default passwords don’t work
…etc

This area of ERPNext is not explained well such as other functional subjects

Looking for your appreciated support

Thanks | Regards,
Magdy Ikladious

Hi @mikladious,

there is an easy way: access MariaDB through the bench console, add a DB user, exit and use that user.

$ bench mariadb
> CREATE USER 'you'@'%' IDENTIFIED BY '*****'; 
> GRANT ALL PRIVILEGES ON *.* TO 'you'@'%' WITH GRANT OPTION;
> exit

Change you with your access name and ***** with your password.

In case you are not using the localhost for the Workbench (which you are using according to the screenshot) also remember to comment out the bind-address in the MaraiDB config.

Hope this helps.

Make sure you have the ports forwarded in the VM.

Thanks for your feedback

It does not work due to that MariaDB user does not have the privileges to create new users as screenshot

Your recommendation is highly appreciated

Thanks for the advise

Done,
however this step does not solve the access issue

Regards,
Magdy

Hi @mikladious

just had this checked and it really no longer works :wink: sorry. Try this and it will work:

$ sudo mysql
> CREATE USER 'magdy'@'%' IDENTIFIED BY 'password'; 
> GRANT ALL PRIVILEGES ON *.* TO 'magdy'@'%' WITH GRANT OPTION;
> exit

Hope this helps.

Hi

I tried it however still not working as per below screenshot

I believe you got my point :slight_smile:
This area not covered well. it depends on try and error with support of kind peers like you

I will continue to search for a solution

Thanks,
Magdy

@mikladious,

Normally mysql can be accessed from Terminal using the command >> sudo mysql -u root -p

Seems like you have some root access issue for the localhost… to reset the mysql root password you need to login to mysql without password…

first stop the mariadb server

sudo /etc/init.d/mysql stop

then start without password

sudo mysqld_safe --skip-grant-tables &

then connect to db

mysql -uroot

then use the default db and set new password

use mysql;
update user set authentication_string=PASSWORD(“mynewpassword”) where User=‘root’;
flush privileges;
.>> exit

then start mariadb
sudo systemctl restart mariadb

then check the status
sudo systemctl status mariadb

if it starts running connect the server again using the new password
sudo mysql -u root -p

You could try via SSH pipe. I am not sure of the post on the VM, but this post may give a useful dirction to move in