error Access denied for user 'root'@'localhost' (using password: YES) running BulkMibCompile.sh script
search cancel

error Access denied for user 'root'@'localhost' (using password: YES) running BulkMibCompile.sh script

book

Article ID: 235411

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

After the upgrade to 21.2.4 or  higher version, running the ./BulkMibCompile.sh -d command you may get the following error

Access denied for user 'root'@'localhost' (using password: YES)

 

 

Environment

Release : 21.2.4 and above

Component :

Cause

Starting from Spectrum 21.2.4 the default mysql root's password has been changed  and BulkMibCompile.sh was run without specifying the mysql user and password parameter.

Resolution

Running the ./BulkMibCompile.sh without parameters you will  get the following help: 

---------------------------------------

# ./BulkMibCompile.sh

  To import all MIBs in a directory:

        BulkMibCompile [ -u <MYSQL USER> ] [ -p <MYSQL PASS> ] -d <MIB DIRECTORY> [ -f <FILE MASK> ] [ -skip_search ] [ -skip_user_save ] [-standard_mibs]

  To clean out the MIB Database :

        BulkMibCompile [ -u <MYSQL USER> ] [ -p <MYSQL PASS> ] -init


The default MySql username and password are root and do not need to be specified if they are correct.


- The file mask can be in the form :
        1. RFC*
        2. *RFC*
        3. *.mib

- The -skip_search will turn off the functionality to search for MIBs that resolve IMPORTS. If all of the MIBs referenced by IMPORT statments are in the current directory and are named their MODULE-NAME, the -skip_search will speed up the compiles if there are alot of MIBs in the directory.

- The -skip_user_save prevents MIBs from being saved off into the userContrib directory. This option is used during the initial database population.

- The -standard_mibs refer to CA bundled MIBs or Customer imported MIB from MIB tools.

-------------------------------------

If  you run the command without any user/password parameters, it will default to use root/root to login to mysql , but the password "root" is no longer valid and the connection to mysql will fail with

Access denied for user 'root'@'localhost' (using password: YES)

At this point  you have two possibilities:

1) specify the user and new default password in the command eg.

[#####@xxxxxx scripts]$ ./BulkMibCompile.sh -u root -p <password>  -d /home/#####/MIBS/Huawei_Mibs/

- to know the new default mysql root's password you can run:

cd $SPECROOT/mysql/bin

export MYSQL_TEST_LOGIN_FILE=$SPECROOT/mysql/data/mylogin.cnf

./my_print_defaults -s --defaults-file=$SPECROOT/mysql/my-spectrum.cnf myclient

 

2) Change the mysql root's default password back to "root"

see https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/21-2/administrating/database-management/configure-mysql-root-password.html

Note: to execute the step #4 (alter user command) you should login to mysql with the root account and new default password to then be able to run the alter command:

cd $SPECROOT/mysql/bin
./mysql --defaults-file=../my-spectrum.cnf -uroot -p<password>
mysql> use mysql;
alter user 'root'@'localhost' IDENTIFIED BY 'root';
mysql> exit