Difference between revisions of "FAQ I Lost my password"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
Tag: 2017 source edit
Tag: 2017 source edit
Line 83: Line 83:
  
 
<source lang="sql">
 
<source lang="sql">
mysql> UPDATE mysql.user SET Password = PASSWORD('anewpassword') WHERE User = 'userusedfordatabaseroot';
+
mysql> UPDATE mysql.user SET Password = PASSWORD('anewpassword') WHERE User = 'userusedfordolibarrdatabase';
 
or on a more recent version
 
or on a more recent version
mysql> SET PASSWORD FOR 'userusedfordatabase@localhost' = PASSWORD('anewpassword');
+
mysql> SET PASSWORD FOR 'userusedfordolibarrdatabase@localhost' = PASSWORD('anewpassword');
 
</source>
 
</source>
 
The to take the change into account.
 
The to take the change into account.

Revision as of 16:36, 18 January 2025

You may have forget your MariaDB or MySQL database password, or, for an unknown reason, it does not works anymore. This is a solution to restore this.

This FAQ speak about a MySQL database administrator password problem and not about the lost of the password of a Dolibarr account used to work on Dolibarr.

With Microsoft Windows

If you lost the root password of MariaDB/MySql

  • Connect to a Windows administrator account on your computer,
  • Go on menu Windows:
   Menu Start -> parameters -> Setup panel -> Administration tools -> Services.
  • Find the service MySQL doliwampmysql into the list and stop it (we assume you installed DoliWamp. Name may differs if using a manuel installation of MySql).
  • Launch the command line command by going to
   Menu Start -> Execute -> cmd
  • Type the following lines to restart MySQL in a particular mode.
   CD C:\dolibarr\bin\mysql\mysql5.0.45\bin 
   C:\dolibarr\bin\mysql\mysql5.0.45\bin\mysqld-nt --skip-grant-tables
  • Launch another command line by going to
   Menu Start -> Execute -> cmd
  • Type in this new windows
   CD C:\dolibarr\bin\mysql\mysql5.0.45\bin 
   C:\dolibarr\bin\mysql\mysql5.0.45\bin\mysql -u root
  • At the MySQL prompt, type
mysql> UPDATE mysql.user SET Password = PASSWORD('anewpassword') WHERE User = 'root';
or on a more recent version
mysql> SET PASSWORD FOR 'root@localhost' = PASSWORD('anewpassword');

And to take change into account

mysql> FLUSH PRIVILEGES;
mysql> QUIT;
  • Type
   C:\dolibarr\bin\mysql\mysql5.0.45\bin\mysqladmin -u root -panewpassword shutdown
  • Restart Windows.


You should now be able to access your MySQL database, you can now tell to Dolibarr to use the new password.

Change the user used by Dolibarr to connect to the database

  • Go into
   C:\dolibarr\www\dolibarr\htdocs\conf 
  • Edit file conf.php to change variable
   $dolibarr_main_db_pass

with value of the new password. The name of user is store into $dolibarr_main_db_user

  • Save file and quit. It should be ok.
  • Go in Windows menu
    Menu Start - > execute -> CMD 
    cd C:\dolibarr\bin\mysql\mysql5.0.45\bin\
    C:\dolibarr\bin\mysql\mysql5.0.45\bin\mysql -u root -ppassword
  • At the MySQL prompt, type
mysql> UPDATE mysql.user SET Password = PASSWORD('anewpassword') WHERE User = 'userusedfordolibarrdatabase';
or on a more recent version
mysql> SET PASSWORD FOR 'userusedfordolibarrdatabase@localhost' = PASSWORD('anewpassword');

The to take the change into account.

mysql> FLUSH PRIVILEGES;
mysql> QUIT;

Note that you may need to change the "localhot" with the ip of the server if the database is onto another server.

Linux

If you lost the root password of Mysql or MariaB

  • Connect to a terminal console with user roor.
  • Stop Mysql:
   /usr/sbin/mysql stop
  • Type the following line to restart MySQL in a particular mode.
   /usr/sbin --skip-grant-tables
  • Launch another terminal console.
  • Type in this new windows
   /usr/bin/mysql -u root
  • At the MySQL prompt, type
mysql> UPDATE mysql.user SET Password = PASSWORD('anewpassword') WHERE User = 'root';
or on a more recent version
mysql> SET PASSWORD FOR 'root@localhost' = PASSWORD('anewpassword');

Then validate the change with

mysql> FLUSH PRIVILEGES;
mysql> QUIT;
  • Type
   /usr/bin/mysqladmin -u root -panewpassword shutdown
  • Restart your server or only mysql server.

You should now be able to access your MySQL database, you can now tell to Dolibarr to use the new password.

Change the user used by Dolibarr to connect to the database

  • Go into
   htdocs\conf 
  • Edit file conf.php to change variable
   $dolibarr_main_db_pass

with value of the new password.

  • Save file and quit. It should be ok.

If Dolibarr use another MySQL user than root,

  • Ru mysql with root user
    /usr/bin/mysql -u root -ppassword
  • At the MySQL prompt, type
mysql> UPDATE mysql.user SET Password = PASSWORD('anothernewpassword') WHERE User = 'userusedbydolibarr';
mysql> FLUSH PRIVILEGES;
mysql> QUIT;
  • Go into
    htdocs\conf 
  • edit file conf.php and search lines
    $dolibarr_main_db_user="xxx";
    $dolibarr_main_db_pass="yyy";

Replace xxx and yyy by real values.

Mac

DoliMamp

En verysmall.png Page waiting to complete. To complete, create an account, go back and clic on "Modify".
Fr verysmall.png Page en attente d'être complété. Pour compléter, créez un compte, revenez et cliquez sur "Modifier".
Es verysmall.png Página a completar. Para completarla, cree una cuenta, vuelva a la página y haga clic en "editar"
De verysmall.png Seite wartet auf Vervollständigung. Um zu helfen, erstelle ein Konto, gehe zurück und klicke auf "Bearbeiten".
Cn verysmall.png 待完成,欲帮助完成,注册帐号,点击“编辑"
Jp verysmall.png ページは未完成の状態です。完成させるにはアカウントを作成し、ページに戻って「編集」をクリックして下さい。