Create mysql root user mysql receipe

Hi all,

I want to create a recipe that install mysql-server and create a root user and passowrd

thanks

Hi,

Why not use a community cookbook for mysql: https://supermarket.chef.io/cookbooks/mysql

Kind regards,

done already seems to be working but how to create the root password

mysqlpass = data_bag_item(“mysql”, “rtpass.json”)

mysql_service “mysqldefault” do
initial_root_password mysqlpass[“password”]
action [:create, :start]
end

seems not getting the password

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Your error does not say the password is incorrect. It says that it cannot connect to the server.

The reason is that the path to the MySQL socket is incorrect. Please review the documentation for the mysql cookbook, especially the headings “Connecting with the mysql CLI command” and “The mysql command line doesn’t work”.