2

I am getting the following error on calling a MySql stored procedure from phpMyAdmin

#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

I am using

call get_ledger_name(2007);

to call the procedure

I have tried changing password for root, creating a new user, but the error still prevails.

6
  • You need to ensure that (a) the username/password is correct and (b) that user has the necessary access to the database and tables. But I would be VERY concerned at your network security if root and no password connects! Commented Dec 26, 2012 at 8:19
  • @Andrew : i have given all privileges Commented Dec 26, 2012 at 8:21
  • @NitinKabra are you sure that the username and password you have entered was correct? Commented Dec 26, 2012 at 8:21
  • OK, ta. Suggest you add (to the question) the EXACT command you're using Commented Dec 26, 2012 at 8:22
  • @JW. yes username and password is correct.. Commented Dec 26, 2012 at 8:23

2 Answers 2

2

Alter stored procedure with DEFINER=root@localhost and then call this SP. It will run.

Try this:

DELIMITER $$

DROP PROCEDURE IF EXISTS `sp_test`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_test`()
BEGIN
/* Your Code Snippet */
/* Your Code Snippet */
/* Your Code Snippet */
END$$

DELIMITER ;
Sign up to request clarification or add additional context in comments.

1 Comment

You have changed password is good but for this issue there is no need to reset the password.
1

Actually you can reset the root password.

But keep in mind that it is not advisable to use root account without password.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.