Problem with Bitcoin Core’s regression test mode
Try changing port number in bitcoin.conf.
open file

nano ~/.bitcoin/bitcoin.conf


add new line


  rpcport=18332;


save the file and restart bitcoind