Chef MySQL cook

Hi Experts
I have installed Mysql 5.7 package via chef.
Now when in try to create Database iam getting error,
Iam using the below to Create Database on Mysql:

mysql_database 'test' do
 connection mysql_server_connection
 action :create
end
mysql_database gives me error like method is undefined.
First i need to install the mysql2 gem

if i try to install mysql2_chef_gem i get error Package: No candidate version available for mysql-community-client, mysql-community-devel

I was unable to install mysql2_chef_gem which i have seen on the marketplace cookbooks but it does not work for me .
Any help or pointers will be very helpful for me.thanks
SandeepiiiDBAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
First do your database create using the mysql command line tool.

If this works, then just drop the database. At this point you'll know if your database subsystem is installed + working correctly.

This looks odd...

mysql_database 'test' do
 connection mysql_server_connection
 action :create
end

Open in new window


There's no admin user/pass credential which has privilege to create a database.

I don't use Chef so maybe this credential lives somewhere in a Chef config file.

Just make sure an admin credential lives somewhere, else all database creates will fail.

Note: When I visit https://supermarket.chef.io/cookbooks/mysql_chef_gem the following message emits...

The mysql_chef_gem cookbook has been deprecated and is no longer being maintained by its authors. Use of the mysql_chef_gem cookbook is no longer recommended.

This does not inspire confidence using Chef + MySQL.

I suggest you just install the Ruby gem + verify you can get this working in Ruby, before working with Chef.
SandeepiiiDBAAuthor Commented:
Thanks for your advise on this question:
I will try to install Ruby gem and test.
I tried to run the
 command mysql -h -u -p -e \'CREATE DATABASE test\'" this command line command works from the chef.
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Awesome!

Glad you got this working!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.