sous-chefs / mysql

Development repository for the mysql cookbook
https://supermarket.chef.io/cookbooks/mysql
Apache License 2.0
337 stars 691 forks source link

Control hash is not picking up the password. #701

Open nitins12 opened 1 year ago

nitins12 commented 1 year ago

I am trying to use a control hash for user root to grant privileges to another user but I am getting the password as null.

[2023-07-19T02:09:05-07:00] DEBUG: Control Hash: [{"user":"root","password":null,"socket":"/var/run/mysql/mysqld.sock"}]

[2023-07-19T02:09:05-07:00] DEBUG: Executing this command: [/usr/bin/mysql -B -e "SELECT User,Host FROM mysql.user WHERE User='profile_api' AND Host='192.168.114.188';" --user=root]

Earlier, we were using database cookbook and argument connection to LWRP as root. Can someone help me here what can we possible wrong.

Below is the provider block I am trying to use.

mysql_user new_resource.username do

connection mysql_con_info

password node['mysql']['server_root_password']
database_name new_resource.database
privileges new_resource.privileges
host local_ip
require_ssl new_resource.connect_over_ssl
action [:create, :grant]

end

Other service would call this block and will try to create and grant the permission to user. I guess if I can figure out why password is null here it would be helpful.